warn on error when user display javascript

This commit is contained in:
Matthias BUSSONNIER 2012-07-27 23:42:38 +02:00
parent 5c394dab71
commit 33edba2c9a

View File

@ -360,7 +360,19 @@ var IPython = (function (IPython) {
container.hide(); container.hide();
// If the Javascript appends content to `element` that should be drawn, then // If the Javascript appends content to `element` that should be drawn, then
// it must also call `container.show()`. // 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')
);
}
} }