diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2018-08-26 16:57:16 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-26 11:03:41 -0400 |
commit | 17d6d6b336e48ab53ae1efa546df7c7b045152da (patch) | |
tree | 013b5fe136c93f7526e10b4b30d7fbab5ba910f8 /js/main.ts | |
parent | 3a5cf9ca8b6a4dae204139faff3f3bbad1f78b54 (diff) |
refactor: add and use libdeno.setGlobalErrorHandler instead of window.onerror
Diffstat (limited to 'js/main.ts')
-rw-r--r-- | js/main.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/main.ts b/js/main.ts index eb90abb0e..51b5790a2 100644 --- a/js/main.ts +++ b/js/main.ts @@ -43,9 +43,21 @@ function onMessage(ui8: Uint8Array) { } } +function onGlobalError( + message: string, + source: string, + lineno: number, + colno: number, + error: Error +) { + console.log(error.stack); + os.exit(1); +} + /* tslint:disable-next-line:no-default-export */ export default function denoMain() { libdeno.recv(onMessage); + libdeno.setGlobalErrorHandler(onGlobalError); const compiler = DenoCompiler.instance(); // First we send an empty "Start" message to let the privlaged side know we |