mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #2199 from Carreau/safe-js
Wrap published javascript in try/catch to show a error if it raises.
This commit is contained in:
commit
99ccdf15d9
@ -360,7 +360,19 @@ var IPython = (function (IPython) {
|
||||
container.hide();
|
||||
// If the Javascript appends content to `element` that should be drawn, then
|
||||
// it must also call `container.show()`.
|
||||
eval(js);
|
||||
try {
|
||||
eval(js);
|
||||
} catch(err) {
|
||||
console.log('Error in Javascript!');
|
||||
console.log(err);
|
||||
container.show();
|
||||
element.append($('<div/>')
|
||||
.html("Error in Javascript !<br/>"+
|
||||
err.toString()+
|
||||
'<br/>See your browser Javascript console for more details.')
|
||||
.addClass('js-error')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user