diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2018-10-08 08:36:09 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-08 11:36:09 -0400 |
commit | 2b8cee9a49e4e654df572f7ad1184f8bdd7a8865 (patch) | |
tree | eca0ffd65b9fb4c842ea72e19b80987ccbd29b0a /js | |
parent | ffb41e61f138a683aac5fd89e0dd72b720c929d6 (diff) |
Check thrown type, print String(...) if not instance of error (#939)
Fixes #935
Diffstat (limited to 'js')
-rw-r--r-- | js/main.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/js/main.ts b/js/main.ts index 265037111..826d3e811 100644 --- a/js/main.ts +++ b/js/main.ts @@ -25,9 +25,13 @@ function onGlobalError( source: string, lineno: number, colno: number, - error: Error + error: any // tslint:disable-line:no-any ) { - console.log(error.stack); + if (error instanceof Error) { + console.log(error.stack); + } else { + console.log(`Thrown: ${String(error)}`); + } os.exit(1); } |