diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-12-13 22:59:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-13 22:59:21 +0100 |
commit | 3551955b6355a8ef677962b6c15adfac349ac01d (patch) | |
tree | 5f8714391ba8910def403b0fd9f44995e078181e /core/01_core.js | |
parent | 878590b77369cf3390b8107b08285bafb29ef2ec (diff) |
refactor(core): add more information when unable to build error (#17027)
This should help debug problem in
https://github.com/denoland/deno/issues/16963
Diffstat (limited to 'core/01_core.js')
-rw-r--r-- | core/01_core.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/01_core.js b/core/01_core.js index 02150674e..2560f979d 100644 --- a/core/01_core.js +++ b/core/01_core.js @@ -129,7 +129,14 @@ } function buildCustomError(className, message, code) { - const error = errorMap[className]?.(message); + let error; + try { + error = errorMap[className]?.(message); + } catch (e) { + throw new Error( + `Unsable to build custom error for "${className}"\n ${e.message}`, + ); + } // Strip buildCustomError() calls from stack trace if (typeof error == "object") { ErrorCaptureStackTrace(error, buildCustomError); |