Show More
@@ -514,15 +514,20 b' define([' | |||
|
514 | 514 | } |
|
515 | 515 | }; |
|
516 | 516 | |
|
517 | var ajax_error_msg = function (jqXHR) { | |
|
518 | // Return a JSON error message if there is one, | |
|
519 | // otherwise the basic HTTP status text. | |
|
520 | if (jqXHR.responseJSON && jqXHR.responseJSON.message) { | |
|
521 | return jqXHR.responseJSON.message; | |
|
522 | } else { | |
|
523 | return jqXHR.statusText; | |
|
524 | } | |
|
525 | } | |
|
517 | 526 | var log_ajax_error = function (jqXHR, status, error) { |
|
518 | 527 | // log ajax failures with informative messages |
|
519 | 528 | var msg = "API request failed (" + jqXHR.status + "): "; |
|
520 | 529 | console.log(jqXHR); |
|
521 | if (jqXHR.responseJSON && jqXHR.responseJSON.message) { | |
|
522 | msg += jqXHR.responseJSON.message; | |
|
523 | } else { | |
|
524 | msg += jqXHR.statusText; | |
|
525 | } | |
|
530 | msg += ajax_error_msg(jqXHR); | |
|
526 | 531 | console.log(msg); |
|
527 | 532 | }; |
|
528 | 533 | |
@@ -547,6 +552,7 b' define([' | |||
|
547 | 552 | platform: platform, |
|
548 | 553 | is_or_has : is_or_has, |
|
549 | 554 | is_focused : is_focused, |
|
555 | ajax_error_msg : ajax_error_msg, | |
|
550 | 556 | log_ajax_error : log_ajax_error, |
|
551 | 557 | }; |
|
552 | 558 |
@@ -2286,17 +2286,14 b' define([' | |||
|
2286 | 2286 | */ |
|
2287 | 2287 | Notebook.prototype.load_notebook_error = function (xhr, status, error) { |
|
2288 | 2288 | this.events.trigger('notebook_load_failed.Notebook', [xhr, status, error]); |
|
2289 | utils.log_ajax_error(xhr, status, error); | |
|
2289 | 2290 | var msg; |
|
2290 | 2291 | if (xhr.status === 400) { |
|
2291 | if (xhr.responseJSON && xhr.responseJSON.message) { | |
|
2292 | msg = escape(xhr.responseJSON.message); | |
|
2293 | } else { | |
|
2294 | msg = escape(error); | |
|
2295 | } | |
|
2292 | msg = escape(utils.ajax_error_msg(xhr)); | |
|
2296 | 2293 | } else if (xhr.status === 500) { |
|
2297 | 2294 | msg = "An unknown error occurred while loading this notebook. " + |
|
2298 | 2295 | "This version can load notebook formats " + |
|
2299 | "v" + this.nbformat + " or earlier."; | |
|
2296 | "v" + this.nbformat + " or earlier. See the server log for details."; | |
|
2300 | 2297 | } |
|
2301 | 2298 | dialog.modal({ |
|
2302 | 2299 | notebook: this, |
General Comments 0
You need to be logged in to leave comments.
Login now