Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle execution errors with empty traceback entries similar to Lab #126

Merged
merged 1 commit into from
Jul 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion nbclassic/static/notebook/js/outputarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,21 @@ define([


OutputArea.prototype.append_error = function (json) {
var ename = json.ename;
var evalue = json.evalue;
var tb = json.traceback;
var s = '';
if (tb !== undefined && tb.length > 0) {
var s = '';
var len = tb.length;
for (var i=0; i<len; i++) {
s = s + tb[i] + '\n';
}
s = s + '\n';
} else if (ename !== undefined && ename.length > 0 && evalue !== undefined && evalue.length > 0) {
// If traceback is empty, and we have ename and evalue entries, concatenate the two to display
s = ename + ': ' + evalue;
}
if (s.length > 0) {
var toinsert = this.create_output_area();
var append_text = OutputArea.append_map[MIME_TEXT];
if (append_text) {
Expand Down