Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Notebook
Commits
a520c74a
Commit
a520c74a
authored
Oct 30, 2020
by
Romain Casati
Browse files
Error redirection.
parent
19b6485f
Changes
1
Hide whitespace changes
Inline
Side-by-side
notebook/basthon/gui.js
View file @
a520c74a
...
...
@@ -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
);
};
};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment