Skip to content

Commit

Permalink
Fixed to raise OSError instead of printing a message.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Cabanela committed Jun 28, 2023
1 parent 3932ae8 commit 44a4ed4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions stellarphot/visualization/comparison_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ def _save_variables_to_file(self, button=None, filename=''):
try:
self.variables.write(filename, overwrite=self.overwrite_outputs)
except OSError:
print(f"ERROR: Can't save variables to file, likely because existing file ({filename}) can not be overwritten. Set overwrite_outputs=True to address this.")

raise OSError(f"Existing file ({filename}) can not be overwritten. Set overwrite_outputs=True to address this.")

def _show_label_button_handler(self, change):
value = change['new']
Expand All @@ -596,7 +595,7 @@ def _save_aperture_to_file(self, button=None, filename=''):
try:
self.generate_table().write(filename, overwrite=self.overwrite_outputs)
except OSError:
print(f"ERROR: Can't save apertures to file, likely because existing file ({filename}) can not be overwritten. Set overwrite_outputs=True to address this.")
raise OSError(f"Existing file ({filename}) can not be overwritten. Set overwrite_outputs=True to address this.")

def _make_control_bar(self):
self._show_labels_button = ipw.ToggleButton(description='Click to show labels')
Expand Down Expand Up @@ -728,7 +727,7 @@ def save_tess_files(self, button=None):
try:
self.iw.save(self._field_name.value)
except OSError:
print(f"ERROR: Can't save full field image, likely because existing file ({self._field_name.value}) can not be overwritten. Set overwrite_outputs=True to address this.")
raise OSError(f"Existing file ({self._field_name.value}) can not be overwritten. Set overwrite_outputs=True to address this.")

if self._zoom_name.value:
self.tess_field_zoom_view()
Expand All @@ -738,7 +737,7 @@ def save_tess_files(self, button=None):
try:
self.iw.save(self._zoom_name.value)
except OSError:
print(f"ERROR: Can't save zoomed image, likely because existing file ({self._zoom_name.value}) can not be overwritten. Set overwrite_outputs=True to address this.")
raise OSError(f"Existing file ({self._zoom_name.value}) can not be overwritten. Set overwrite_outputs=True to address this.")

def generate_table(self):
"""
Expand Down

0 comments on commit 44a4ed4

Please sign in to comment.