diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-27 00:15:52 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-27 00:16:09 -0400 |
commit | 65a2c4b421cd16328a663b2803f1e42bf5bdd180 (patch) | |
tree | c6875cd6273bd1afad458954187c0b8cfefdf21a | |
parent | fe6e4febdb6858695cd86c75a9377ede3ca484f9 (diff) |
Add onerror handler for uncaught exceptions
-rw-r--r-- | runtime.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime.ts b/runtime.ts index ca7af884c..52277653f 100644 --- a/runtime.ts +++ b/runtime.ts @@ -23,6 +23,12 @@ const deno = { pub, sub }; type AmdFactory = (...args: any[]) => undefined | object; type AmdDefine = (deps: string[], factory: AmdFactory) => void; +// Uncaught exceptions are sent to window.onerror by v8worker2. +window.onerror = function(message, source, lineno, colno, error) { + console.log(error.message, error.stack); + os.exit(1); +}; + export function setup(mainJs: string, mainMap: string): void { sourceMaps.install({ installPrepareStackTrace: true, |