From 58a2ec273336976ef689d0f0af1e01fc47e5fc87 Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Fri, 17 May 2024 20:09:59 -1000 Subject: [PATCH] Raise an exception to break observing loop if not safe. --- src/panoptes/pocs/utils/cli/run.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/panoptes/pocs/utils/cli/run.py b/src/panoptes/pocs/utils/cli/run.py index 584e8a6e3..0fb9d3eab 100644 --- a/src/panoptes/pocs/utils/cli/run.py +++ b/src/panoptes/pocs/utils/cli/run.py @@ -5,6 +5,7 @@ from typing import List import typer +from panoptes.utils.error import PanError from panoptes.utils.time import current_time from panoptes.utils.utils import altaz_to_radec, listify from rich import print @@ -144,7 +145,7 @@ def get_altaz_observation(coords, seq_time) -> Observation: for i, altaz_coord in enumerate(altaz_coords): if pocs.is_safe() is False: print('[red]POCS is not safe, shutting down.[/red]') - break + raise PanError('POCS is not safe.') print(f'{field_name} #{i:02d}/{len(altaz_coords):02d} {altaz_coord=}') @@ -187,6 +188,9 @@ def get_altaz_observation(coords, seq_time) -> Observation: except Exception as e: print('[bold red]POCS encountered an error.[/bold red]') print(e) + except PanError as e: + print('[bold red]POCS encountered an error.[/bold red]') + print(e) else: print('[green]POCS alignment finished, shutting down.[/green]') finally: