Commit a520c74a authored by Romain Casati's avatar Romain Casati
Browse files

Error redirection.

parent 19b6485f
......@@ -40,6 +40,38 @@ window.basthonGUI = (function () {
that.notebook.events.bind(
event, () => { that.saveToStorage(); } );
}
/* all errors redirected to notification system */
that.connectGlobalErrors();
};
/**
* All errors are redirected to notification system.
*/
that.connectGlobalErrors = function () {
function onerror(message) {
that.dialog.modal({
notebook: that.notebook,
keyboard_manager: that.notebook.keyboard_manager,
title : "Erreur",
body : message,
buttons : {
OK: {
"class": "btn-danger",
},
},
});
}
/* all errors redirected to notification system */
window.addEventListener('error', function(error) {
onerror(error.message);
});
/* console errors redirected to notification system */
const _error = console.error;
console.error = function() {
onerror(String(arguments[0]));
return _error.apply(console, arguments);
};
};
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment