mirror of
https://github.com/denoland/deno.git
synced 2025-07-29 08:04:00 +00:00
Error pretty print (print stack)
This commit is contained in:
parent
32806b1871
commit
1e390e69cd
2 changed files with 79 additions and 47 deletions
|
@ -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");
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue