Skip to content

Commit

Permalink
Raise an exception to break observing loop if not safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed May 18, 2024
1 parent 5dc0d42 commit 58a2ec2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/panoptes/pocs/utils/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.')

Check warning on line 148 in src/panoptes/pocs/utils/cli/run.py

View check run for this annotation

Codecov / codecov/patch

src/panoptes/pocs/utils/cli/run.py#L147-L148

Added lines #L147 - L148 were not covered by tests

print(f'{field_name} #{i:02d}/{len(altaz_coords):02d} {altaz_coord=}')

Expand Down Expand Up @@ -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)

Check warning on line 193 in src/panoptes/pocs/utils/cli/run.py

View check run for this annotation

Codecov / codecov/patch

src/panoptes/pocs/utils/cli/run.py#L191-L193

Added lines #L191 - L193 were not covered by tests
else:
print('[green]POCS alignment finished, shutting down.[/green]')
finally:
Expand Down

0 comments on commit 58a2ec2

Please sign in to comment.