Merge pull request #899 from marcelklehr/fix/show-onload-errors

Display errors occuring on page load to the user.
pull/914/merge
John McLear 2012-08-12 08:55:24 -07:00
commit a5f6815e65
1 changed files with 17 additions and 0 deletions

View File

@ -322,6 +322,23 @@
<% e.end_block(); %>
<% e.begin_block("scripts"); %>
<script type="text/javascript">
/* Display errors on page load to the user
(Gets overridden by padutils.setupGlobalExceptionHandler)
*/
(function() {
var originalHandler = window.onerror;
window.onerror = function(msg, url, line) {
var box = document.getElementById('editorloadingbox');
box.innerHTML = '<p><b>An error occured while loading the pad</b></p>'
+ '<p><b>'+msg+'</b> '
+ '<small>in '+ url +' (line '+ line +')</small></p>';
// call original error handler
if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments);
};
})();
</script>
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script>