mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
Check thrown type, print String(...) if not instance of error (#939)
Fixes #935
This commit is contained in:
parent
ffb41e61f1
commit
2b8cee9a49
3 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
1
tests/error_007_any.ts
Normal file
1
tests/error_007_any.ts
Normal file
|
@ -0,0 +1 @@
|
|||
throw {};
|
1
tests/error_007_any.ts.out
Normal file
1
tests/error_007_any.ts.out
Normal file
|
@ -0,0 +1 @@
|
|||
Thrown: [object Object]
|
Loading…
Reference in a new issue