diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index fc83026..923b4d3 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -447,25 +447,29 @@ Notebook.prototype._kernel_started = function () { this.kernel.iopub_channel.onmessage = function (e) { reply = $.parseJSON(e.data); + var content = reply.content; console.log(reply); var msg_type = reply.msg_type; var cell = that.cell_for_msg(reply.parent_header.msg_id); if (msg_type === "stream") { cell.expand(); - cell.append_stream(reply.content.data + "\n"); + cell.append_stream(content.data + "\n"); } else if (msg_type === "display_data") { cell.expand(); - cell.append_display_data(reply.content.data); + cell.append_display_data(content.data); } else if (msg_type === "pyout") { cell.expand(); - cell.append_pyout(reply.content.data, reply.content.execution_count) + cell.append_pyout(content.data, content.execution_count) + } else if (msg_type === "pyerr") { + cell.expand(); + cell.append_pyerr(content.ename, content.evalue, content.traceback); } else if (msg_type === "status") { - if (reply.content.execution_state === "busy") { + if (content.execution_state === "busy") { that.kernel.status_busy(); - } else if (reply.content.execution_state === "idle") { + } else if (content.execution_state === "idle") { that.kernel.status_idle(); }; - }; + } }; }; @@ -654,6 +658,16 @@ CodeCell.prototype.append_pyout = function (data, n) { }; }; +CodeCell.prototype.append_pyerr = function (ename, evalue, tb) { + var s = ''; + var len = tb.length; + for (var i=0; i