Skip to content
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

Merged
merged 3 commits into from Aug 14, 2014

Conversation

minrk
Copy link
Member

@minrk minrk commented Aug 13, 2014

  • fix missing import in nbformat.reader.reads
  • show JSON error message if there is one

Before, opening a v4 notebook would show:

Error: Bad Request

After, it shows the intended:

Unreadable Notebook: /path/to/notebook.ipynb Unsupported nbformat version 4

Should be backported to 2.x

opening unreadable notebook format failed with 'NameError: NBFormatError'
instead of the expected error.
@takluyver takluyver added this to the 2.3 milestone Aug 13, 2014
@takluyver
Copy link
Member

LGTM

@ellisonbg
Copy link
Member

@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) {
Copy link
Member

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?

Copy link
Member Author

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.

@ellisonbg
Copy link
Member

I left one comment. Didn't test though.

@ellisonbg
Copy link
Member

This looks good, I would say you can merge unless @takluyver wants to comment.

takluyver added a commit that referenced this pull request Aug 14, 2014
Fix error message when failing to load a notebook
@takluyver takluyver merged commit 6b26075 into ipython:master Aug 14, 2014
@minrk minrk deleted the nbformat-error branch August 14, 2014 03:31
@minrk minrk mentioned this pull request Aug 26, 2014
minrk added a commit that referenced this pull request Sep 11, 2014
- fix missing import in nbformat.reader.reads
- show JSON error message if there is one

Before, opening a v4 notebook would show:

...
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Fix error message when failing to load a notebook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants