Skip to content

Commit

Permalink
Merge pull request ipython#3621 from minrk/htmlerror
Browse files Browse the repository at this point in the history
catch any exception appending output

HTML output can have javascript with errors, etc.

No output should ever raise, no matter what.

closes ipython#3620
  • Loading branch information
minrk committed Jul 16, 2013
2 parents bda816a + 39e1da7 commit 39d493b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion IPython/html/static/notebook/js/outputarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,19 @@ var IPython = (function (IPython) {
toinsert.find('div.prompt').addClass('output_prompt').html('Out[' + n + ']:');
}
this.append_mime_type(json, toinsert, dynamic);
this.element.append(toinsert);
try {
this.element.append(toinsert);
} catch(err) {
console.log("Error attaching output!");
console.log(err);
this.element.show();
toinsert.html($('<div/>')
.html("Javascript error adding output!<br/>" +
err.toString() +
'<br/>See your browser Javascript console for more details.')
.addClass('js-error')
);
}
// If we just output latex, typeset it.
if ((json.latex !== undefined) || (json.html !== undefined)) {
this.typeset();
Expand Down

0 comments on commit 39d493b

Please sign in to comment.