fix: Format non-error exceptions (#14604)

This commit adds "Deno.core.setFormatExceptionCallback" which
can be used to provide custom formatting for errors. It is useful
in cases when user throws something that is non-Error (eg.
a string, plain object, etc).
This commit is contained in:
Nayeem Rahman 2022-06-06 19:26:57 +01:00 committed by GitHub
parent 1081659be1
commit e3eae662f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 177 additions and 27 deletions

View file

@ -217,14 +217,16 @@
let msg = `Test case is leaking async ops.
- ${ArrayPrototypeJoin(details, "\n - ")}`;
- ${ArrayPrototypeJoin(details, "\n - ")}`;
if (!core.isOpCallTracingEnabled()) {
msg +=
`\n\nTo get more details where ops were leaked, run again with --trace-ops flag.`;
} else {
msg += "\n";
}
throw msg;
throw assert(false, msg);
};
}