whole-tale / dashboard

Whole Tale Dashboard
http://wholetale.org
MIT License
7 stars 2 forks source link

Handling invalid environment during AiWT #585

Closed craig-willis closed 4 years ago

craig-willis commented 4 years ago

This is minor, but I had a mismatch in the environment name ("Jupyter Lab" v "JupyterLab") between the stage and local environments and noticed during testing that a helpful error message is swallowed by the error handler:

https://dashboard.local.wholetale.org/browse?uri=https%3A%2F%2Fdoi.org%2F10.5281%2Fzenodo.1215988&name=weecology%2FPortalData&environment=XXX

Screen Shot 2020-01-21 at 12 50 16 PM

The actual error in this case is "Could not find specified environment: XXX"

I also noticed that the "Create" button is disabled in this case.

Possible solutions:

ThomasThelen commented 4 years ago

It looks like the issue is handleError. If it gets an error with a responsJSON field it will set the error message to responseJSON.message. If it gets a generic exception (which has e.message) it will use the default error message, "There was an error while creating your Tale".

I think this is to gobble up any nasty stack traces that the system gives and instead give a nice message to the user. In our case, we create an exception that looks identical to the ones we're trying to gobble up.

If we're fine with setting the error message without using handleError, which may be counter-style I have a branch here that I can turn into a PR.