Adds dialog on new_notebook failure

This logic doesn't really belong in ContentManager.  It would be better to trigger an event, which is handled somewhere else.  But there's no obvious place to put this event, so creating the error dialog inside the new_notebook method is ok for now.
KesterTong 12 years ago committed by Thomas Kluyver
parent 5717a3eb10
commit d17ca85f5b

@ -5,7 +5,8 @@ define([
'base/js/namespace',
'jquery',
'base/js/utils',
], function(IPython, $, utils) {
'base/js/dialog',
], function(IPython, $, utils, dialog) {
var ContentManager = function(options) {
// Constructor
//
@ -50,7 +51,20 @@ define([
'_blank'
);
},
error : utils.log_ajax_error,
error : function(xhr, status, error) {
utils.log_ajax_error(xhr, status, error);
var msg;
if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message;
} else {
msg = xhr.statusText;
}
dialog.modal({
title : 'Creating Notebook Failed',
body : "The error was: " + msg,
buttons : {'OK' : {'class' : 'btn-primary'}}
});
}
};
var url = utils.url_join_encode(
base_url,

Loading…
Cancel
Save