From a506625e405c37bbed42eda074a5b22110bbd92d Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Mon, 7 Apr 2025 14:22:43 +0100 Subject: [PATCH] Treat cancellation and other errors differently --- .../things/camera_stage_mapping.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/camera_stage_mapping.py b/src/openflexure_microscope_server/things/camera_stage_mapping.py index 30fb7d10..ab6d4058 100644 --- a/src/openflexure_microscope_server/things/camera_stage_mapping.py +++ b/src/openflexure_microscope_server/things/camera_stage_mapping.py @@ -207,9 +207,13 @@ class CameraStageMapper(Thing): result: dict = calibrate_backlash_1d( tracker, move, direction_array, logger=logger ) - except (InvocationCancelledError, MappingError) as e: + except InvocationCancelledError as e: + logger.info("User cancelled the camera stage mapping calibration") logger.info("Returning to starting position") stage.move_absolute(**starting_position, block_cancellation=True) + except MappingError as e: + logger.info("Returning to starting position due to failed calibration") + stage.move_absolute(**starting_position, block_cancellation=True) raise e result["move_history"] = move.history result["image_resolution"] = hw.grab_image().shape[:2]