From 2b8cee9a49e4e654df572f7ad1184f8bdd7a8865 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Mon, 8 Oct 2018 08:36:09 -0700 Subject: Check thrown type, print String(...) if not instance of error (#939) Fixes #935 --- js/main.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'js/main.ts') 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); } -- cgit v1.2.3