##// END OF EJS Templates
Basic exception display in the notebook is working.
Brian Granger -
Show More
@@ -447,25 +447,29 b' Notebook.prototype._kernel_started = function () {'
447
447
448 this.kernel.iopub_channel.onmessage = function (e) {
448 this.kernel.iopub_channel.onmessage = function (e) {
449 reply = $.parseJSON(e.data);
449 reply = $.parseJSON(e.data);
450 var content = reply.content;
450 console.log(reply);
451 console.log(reply);
451 var msg_type = reply.msg_type;
452 var msg_type = reply.msg_type;
452 var cell = that.cell_for_msg(reply.parent_header.msg_id);
453 var cell = that.cell_for_msg(reply.parent_header.msg_id);
453 if (msg_type === "stream") {
454 if (msg_type === "stream") {
454 cell.expand();
455 cell.expand();
455 cell.append_stream(reply.content.data + "\n");
456 cell.append_stream(content.data + "\n");
456 } else if (msg_type === "display_data") {
457 } else if (msg_type === "display_data") {
457 cell.expand();
458 cell.expand();
458 cell.append_display_data(reply.content.data);
459 cell.append_display_data(content.data);
459 } else if (msg_type === "pyout") {
460 } else if (msg_type === "pyout") {
460 cell.expand();
461 cell.expand();
461 cell.append_pyout(reply.content.data, reply.content.execution_count)
462 cell.append_pyout(content.data, content.execution_count)
463 } else if (msg_type === "pyerr") {
464 cell.expand();
465 cell.append_pyerr(content.ename, content.evalue, content.traceback);
462 } else if (msg_type === "status") {
466 } else if (msg_type === "status") {
463 if (reply.content.execution_state === "busy") {
467 if (content.execution_state === "busy") {
464 that.kernel.status_busy();
468 that.kernel.status_busy();
465 } else if (reply.content.execution_state === "idle") {
469 } else if (content.execution_state === "idle") {
466 that.kernel.status_idle();
470 that.kernel.status_idle();
467 };
471 };
468 };
472 }
469 };
473 };
470 };
474 };
471
475
@@ -654,6 +658,16 b' CodeCell.prototype.append_pyout = function (data, n) {'
654 };
658 };
655 };
659 };
656
660
661 CodeCell.prototype.append_pyerr = function (ename, evalue, tb) {
662 var s = '';
663 var len = tb.length;
664 for (var i=0; i<len; i++) {
665 s = s + tb[i] + '\n';
666 }
667 s = s + '\n';
668 this.append_stream(s);
669 };
670
657
671
658 CodeCell.prototype.append_display_data = function (data, element) {
672 CodeCell.prototype.append_display_data = function (data, element) {
659 if (data["text/latex"] !== undefined) {
673 if (data["text/latex"] !== undefined) {
General Comments 0
You need to be logged in to leave comments. Login now