Convert error handler to ES6 module
We no longer support older browsers, so this is not allowed to use modern features.
This commit is contained in:
parent
2f602da961
commit
c143a852b1
|
@ -6,16 +6,6 @@
|
||||||
* See README.md for usage and integration instructions.
|
* See README.md for usage and integration instructions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// NB: this should *not* be included as a module until we have
|
|
||||||
// native support in the browsers, so that our error handler
|
|
||||||
// can catch script-loading errors.
|
|
||||||
|
|
||||||
// No ES6 can be used in this file since it's used for the translation
|
|
||||||
/* eslint-disable prefer-arrow-callback */
|
|
||||||
|
|
||||||
(function _scope() {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Fallback for all uncought errors
|
// Fallback for all uncought errors
|
||||||
function handleError(event, err) {
|
function handleError(event, err) {
|
||||||
try {
|
try {
|
||||||
|
@ -67,6 +57,6 @@
|
||||||
// from being printed to the browser console.
|
// from being printed to the browser console.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
window.addEventListener('error', function onerror(evt) { handleError(evt, evt.error); });
|
|
||||||
window.addEventListener('unhandledrejection', function onreject(evt) { handleError(evt.reason, evt.reason); });
|
window.addEventListener('error', evt => handleError(evt, evt.error));
|
||||||
})();
|
window.addEventListener('unhandledrejection', evt => handleError(evt.reason, evt.reason));
|
||||||
|
|
2
vnc.html
2
vnc.html
|
@ -55,7 +55,7 @@
|
||||||
<link rel="preload" as="image" href="app/images/error.svg">
|
<link rel="preload" as="image" href="app/images/error.svg">
|
||||||
<link rel="preload" as="image" href="app/images/warning.svg">
|
<link rel="preload" as="image" href="app/images/warning.svg">
|
||||||
|
|
||||||
<script src="app/error-handler.js"></script>
|
<script type="module" crossorigin="anonymous" src="app/error-handler.js"></script>
|
||||||
<script type="module" crossorigin="anonymous" src="app/ui.js"></script>
|
<script type="module" crossorigin="anonymous" src="app/ui.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue