Fixed import and re-raise cancelled error

This commit is contained in:
jaknapper 2025-04-07 15:46:20 +01:00
parent a506625e40
commit 33c74741fe

View file

@ -32,7 +32,7 @@ from camera_stage_mapping.camera_stage_calibration_1d import (
calibrate_backlash_1d,
image_to_stage_displacement_from_1d,
)
from camera_stage_mapping.exceoptions import MappingError
from camera_stage_mapping.exceptions import MappingError
from labthings_fastapi.dependencies.invocation import (
InvocationCancelledError,
InvocationLogger,
@ -211,6 +211,7 @@ class CameraStageMapper(Thing):
logger.info("User cancelled the camera stage mapping calibration")
logger.info("Returning to starting position")
stage.move_absolute(**starting_position, block_cancellation=True)
raise e
except MappingError as e:
logger.info("Returning to starting position due to failed calibration")
stage.move_absolute(**starting_position, block_cancellation=True)