diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2018-09-26 09:44:59 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-09-26 19:30:43 -0400 |
commit | 1e390e69cd45aeb4570fe821ef0ea866b71433e6 (patch) | |
tree | 4c8037a9b3a9aa16d4689cb5ec72285ef8ab345b /js/console_test.ts | |
parent | 32806b18719f09ec3c1f5b41f3a8f98321328884 (diff) |
Error pretty print (print stack)
Diffstat (limited to 'js/console_test.ts')
-rw-r--r-- | js/console_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/js/console_test.ts b/js/console_test.ts index cfe75dafe..94a627a5f 100644 --- a/js/console_test.ts +++ b/js/console_test.ts @@ -91,3 +91,17 @@ test(function consoleTestStringifyCircular() { "Console { printFunc: [Function], debug: [Function: log], info: [Function: log], error: [Function: warn] }" ); }); + +test(function consoleTestError() { + class MyError extends Error { + constructor(msg: string) { + super(msg); + this.name = "MyError"; + } + } + try { + throw new MyError("This is an error"); + } catch (e) { + assertEqual(stringify(e).split("\n")[0], "MyError: This is an error"); + } +}); |