Merge pull request #3741 from minrk/badnbmsg

better message when notebook format is not supported

different messages for bad version and bad JSON.

closes #1592
pull/37/head
Matthias Bussonnier 13 years ago
commit 68cf7df38a

@ -146,8 +146,9 @@ class FileNotebookManager(NotebookManager):
try:
# v1 and v2 and json in the .ipynb files.
nb = current.reads(s, u'json')
except Exception as e:
raise web.HTTPError(500, u'Unreadable JSON notebook: %s' % e)
except ValueError as e:
msg = u"Unreadable Notebook: %s" % e
raise web.HTTPError(400, msg, reason=msg)
return last_modified, nb
def read_notebook_object(self, notebook_id):

@ -1794,20 +1794,20 @@ var IPython = (function (IPython) {
* @param {String} errorThrow HTTP error message
*/
Notebook.prototype.load_notebook_error = function (xhr, textStatus, errorThrow) {
if (xhr.status === 500) {
var msg = "An error occurred while loading this notebook. Most likely " +
"this notebook is in a newer format than is supported by this " +
"version of IPython. This version can load notebook formats " +
"v"+this.nbformat+" or earlier.";
IPython.dialog.modal({
title: "Error loading notebook",
body : msg,
buttons : {
"OK": {}
}
});
if (xhr.status === 400) {
var msg = errorThrow;
} else if (xhr.status === 500) {
var msg = "An unknown error occurred while loading this notebook. " +
"This version can load notebook formats " +
"v" + this.nbformat + " or earlier.";
}
IPython.dialog.modal({
title: "Error loading notebook",
body : msg,
buttons : {
"OK": {}
}
});
}
/********************* checkpoint-related *********************/

Loading…
Cancel
Save