diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArFeatures.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 24ba8e3..87293ee 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -61,6 +61,15 @@ class LoadingFailed(Exception): super().__init__(message) +class DrawingFailed(Exception): + """ + Exception raised when drawing fails. + """ + + def __init__(self, message): + + super().__init__(message) + # Define default ArLayer draw parameters DEFAULT_ARLAYER_DRAW_PARAMETERS = { "draw_aoi_scene": { @@ -856,7 +865,13 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject): for layer_name, draw_layer in draw_layers.items(): - self.__layers[layer_name].draw(image, **draw_layer) + try : + + self.__layers[layer_name].draw(image, **draw_layer) + + except KeyError: + + raise(DrawingFailed(f'\'{layer_name}\' layer doesn\'t exist.')) # Draw current gaze position if required if draw_gaze_positions is not None: |