mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-07 13:07:22 +08:00
better message when notebook format is not supported
Different messages for bad version and bad JSON. closes #1592
This commit is contained in:
parent
6fd10471e1
commit
2a09958bb6
@ -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,12 +1794,13 @@ 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.";
|
||||
|
||||
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,
|
||||
@ -1808,7 +1809,6 @@ var IPython = (function (IPython) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/********************* checkpoint-related *********************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user