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:
|
try:
|
||||||
# v1 and v2 and json in the .ipynb files.
|
# v1 and v2 and json in the .ipynb files.
|
||||||
nb = current.reads(s, u'json')
|
nb = current.reads(s, u'json')
|
||||||
except Exception as e:
|
except ValueError as e:
|
||||||
raise web.HTTPError(500, u'Unreadable JSON notebook: %s' % e)
|
msg = u"Unreadable Notebook: %s" % e
|
||||||
|
raise web.HTTPError(400, msg, reason=msg)
|
||||||
return last_modified, nb
|
return last_modified, nb
|
||||||
|
|
||||||
def read_notebook_object(self, notebook_id):
|
def read_notebook_object(self, notebook_id):
|
||||||
|
@ -1794,20 +1794,20 @@ var IPython = (function (IPython) {
|
|||||||
* @param {String} errorThrow HTTP error message
|
* @param {String} errorThrow HTTP error message
|
||||||
*/
|
*/
|
||||||
Notebook.prototype.load_notebook_error = function (xhr, textStatus, errorThrow) {
|
Notebook.prototype.load_notebook_error = function (xhr, textStatus, errorThrow) {
|
||||||
if (xhr.status === 500) {
|
if (xhr.status === 400) {
|
||||||
var msg = "An error occurred while loading this notebook. Most likely " +
|
var msg = errorThrow;
|
||||||
"this notebook is in a newer format than is supported by this " +
|
} else if (xhr.status === 500) {
|
||||||
"version of IPython. This version can load notebook formats " +
|
var msg = "An unknown error occurred while loading this notebook. " +
|
||||||
"v"+this.nbformat+" or earlier.";
|
"This version can load notebook formats " +
|
||||||
|
"v" + this.nbformat + " or earlier.";
|
||||||
IPython.dialog.modal({
|
|
||||||
title: "Error loading notebook",
|
|
||||||
body : msg,
|
|
||||||
buttons : {
|
|
||||||
"OK": {}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
IPython.dialog.modal({
|
||||||
|
title: "Error loading notebook",
|
||||||
|
body : msg,
|
||||||
|
buttons : {
|
||||||
|
"OK": {}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************* checkpoint-related *********************/
|
/********************* checkpoint-related *********************/
|
||||||
|
Loading…
Reference in New Issue
Block a user