diff --git a/IPython/html/services/sessions/handlers.py b/IPython/html/services/sessions/handlers.py index 603dabc..8b4a6d3 100644 --- a/IPython/html/services/sessions/handlers.py +++ b/IPython/html/services/sessions/handlers.py @@ -56,7 +56,11 @@ class SessionRootHandler(IPythonHandler): try: model = sm.create_session(name=name, path=path, kernel_name=kernel_name) except NoSuchKernel: - raise web.HTTPError(400, "No such kernel: %s" % kernel_name) + msg = ("The '%s' kernel is not available. Please pick another " + "suitable kernel instead, or install that kernel." % kernel_name) + status_msg = 'Kernel not found' + msg = dict(full=msg, short=status_msg) + raise web.HTTPError(400, json.dumps(msg)) location = url_path_join(self.base_url, 'api', 'sessions', model['id']) self.set_header('Location', url_escape(location)) diff --git a/IPython/html/static/notebook/js/notificationarea.js b/IPython/html/static/notebook/js/notificationarea.js index c2f9837..a87e3e8 100644 --- a/IPython/html/static/notebook/js/notificationarea.js +++ b/IPython/html/static/notebook/js/notificationarea.js @@ -185,31 +185,21 @@ define([ }); this.events.on('start_failed.Session',function (session, xhr, status, error) { - var msg = $('
'); - msg.append($('') - .text('The kernel could not be started. This might ' + - 'happen if the notebook was previously run with a kernel ' + - 'that you do not have installed. Please choose a different kernel, ' + - 'or install the needed kernel and then refresh this page.') - .css('margin-bottom', '1em')); + var msg = JSON.parse(status.responseJSON.message); - msg.append($('') - .text('The exact error was:') - .css('margin-bottom', '1em')); - - msg.append($('') - .attr('class', 'alert alert-danger') - .attr('role', 'alert') - .text(JSON.parse(status.responseText).message)); - - dialog.modal({ - title: "Failed to start the kernel", - body : msg, - keyboard_manager: that.keyboard_manager, - notebook: that.notebook, - buttons : { - "Ok": { class: 'btn-primary' } - } + that.save_widget.update_document_title(); + $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead'); + knw.danger(msg.short, undefined, function () { + dialog.modal({ + title: "Failed to start the kernel", + body : msg.full, + keyboard_manager: that.keyboard_manager, + notebook: that.notebook, + buttons : { + "Ok": { class: 'btn-primary' } + } + }); + return false; }); }); diff --git a/IPython/html/static/services/sessions/js/session.js b/IPython/html/static/services/sessions/js/session.js index 14a93af..d8d5b56 100644 --- a/IPython/html/static/services/sessions/js/session.js +++ b/IPython/html/static/services/sessions/js/session.js @@ -112,7 +112,6 @@ define([ Session.prototype._handle_start_failure = function (xhr, status, error) { this.events.trigger('start_failed.Session', [this, xhr, status, error]); - this.events.trigger('status_dead.Kernel'); }; /**