pyerr -> error

This commit is contained in:
MinRK 2013-11-13 15:39:27 -08:00
parent 38c76aa913
commit 5fb9837f5a
2 changed files with 12 additions and 9 deletions

View File

@ -225,10 +225,13 @@ var IPython = (function (IPython) {
json.output_type = "pyout"; json.output_type = "pyout";
json.metadata = content.metadata; json.metadata = content.metadata;
json.prompt_number = content.execution_count; json.prompt_number = content.execution_count;
} else if (msg_type === "pyerr") { } else if (msg_type === "error") {
json.ename = content.ename; // pyerr message has been renamed to error,
json.evalue = content.evalue; // but the nbformat has not been updated,
json.traceback = content.traceback; // so transform back to pyerr for json.
json.output_type = "pyerr";
json = this.convert_mime_types(json, content.data);
json.metadata = this.convert_mime_types({}, content.metadata);
} }
this.append_output(json); this.append_output(json);
}; };
@ -285,7 +288,7 @@ var IPython = (function (IPython) {
if (json.output_type === 'pyout') { if (json.output_type === 'pyout') {
this.append_execute_result(json); this.append_execute_result(json);
} else if (json.output_type === 'pyerr') { } else if (json.output_type === 'pyerr') {
this.append_pyerr(json); this.append_error(json);
} else if (json.output_type === 'stream') { } else if (json.output_type === 'stream') {
this.append_stream(json); this.append_stream(json);
} }
@ -425,7 +428,7 @@ var IPython = (function (IPython) {
}; };
OutputArea.prototype.append_pyerr = function (json) { OutputArea.prototype.append_error = function (json) {
var tb = json.traceback; var tb = json.traceback;
if (tb !== undefined && tb.length > 0) { if (tb !== undefined && tb.length > 0) {
var s = ''; var s = '';

View File

@ -76,13 +76,13 @@ var IPython = (function (IPython) {
// Initialize the iopub handlers // Initialize the iopub handlers
Kernel.prototype.init_iopub_handlers = function () { Kernel.prototype.init_iopub_handlers = function () {
var output_types = ['stream', 'display_data', 'execute_result', 'pyerr']; var output_msg_types = ['stream', 'display_data', 'execute_result', 'error'];
this._iopub_handlers = {}; this._iopub_handlers = {};
this.register_iopub_handler('status', $.proxy(this._handle_status_message, this)); this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this)); this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
for (var i=0; i < output_types.length; i++) { for (var i=0; i < output_msg_types.length; i++) {
this.register_iopub_handler(output_types[i], $.proxy(this._handle_output_message, this)); this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
} }
}; };