mirror of
https://github.com/denoland/deno.git
synced 2025-08-01 17:42:32 +00:00
refactor: add and use libdeno.setGlobalErrorHandler instead of window.onerror
This commit is contained in:
parent
3a5cf9ca8b
commit
17d6d6b336
7 changed files with 88 additions and 56 deletions
12
js/main.ts
12
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue