Skip to content

Commit

Permalink
Merge pull request spacetelescope#384 from rosteen/no-data-error
Browse files Browse the repository at this point in the history
Fix nonexistent file load
  • Loading branch information
rosteen authored Jan 19, 2021
2 parents a67b10e + 815bf0f commit 9ce9b1f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ def load_data(self, file_obj, parser_reference=None, **kwargs):
# Properly form path and check if a valid file
file_obj = pathlib.Path(file_obj)
if not file_obj.exists():
raise FileNotFoundError("Could not locate file: " + file_obj)
msg_text = "Error: File {} does not exist".format(file_obj)
snackbar_message = SnackbarMessage(msg_text, sender=self,
color='error')
self.hub.broadcast(snackbar_message)
raise FileNotFoundError("Could not locate file: {}".format(file_obj))
else:
# Convert path to properly formatted string (Parsers do not accept path objs)
file_obj = str(file_obj)
Expand Down

0 comments on commit 9ce9b1f

Please sign in to comment.