New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error message when failing to load a notebook #6303
Conversation
opening unreadable notebook format failed with 'NameError: NBFormatError' instead of the expected error.
LGTM |
@takluyver have you reviewed this? |
@@ -2288,7 +2288,11 @@ define([ | |||
this.events.trigger('notebook_load_failed.Notebook', [xhr, status, error]); | |||
var msg; | |||
if (xhr.status === 400) { | |||
msg = error; | |||
if (xhr.responseJSON && xhr.responseJSON.message) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this same logic here and above in utils.js. Do we want a function in utils.js that takes an xhr and returns a properly selected error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added utils.ajax_error_msg(jqXHR)
and used it in both places.
I left one comment. Didn't test though. |
if there is one (escaped for safety).
This looks good, I would say you can merge unless @takluyver wants to comment. |
Fix error message when failing to load a notebook
- fix missing import in nbformat.reader.reads - show JSON error message if there is one Before, opening a v4 notebook would show: ...
Fix error message when failing to load a notebook
Before, opening a v4 notebook would show:
After, it shows the intended:
Should be backported to 2.x