diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-06-06 19:26:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-06 20:26:57 +0200 |
commit | e3eae662f3d753141571bd132ccb199f95c745ea (patch) | |
tree | e0cdad78f409c9b221b909d0d7dfcee286e6325f /runtime/js/40_testing.js | |
parent | 1081659be176a59512a7e9e3dc93e13046a26aec (diff) |
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).
Diffstat (limited to 'runtime/js/40_testing.js')
-rw-r--r-- | runtime/js/40_testing.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index 8c7d69fb0..865482042 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -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); }; } |