summaryrefslogtreecommitdiff
path: root/cli/rt/10_dispatch_minimal.js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-10-05 20:35:51 +1100
committerGitHub <noreply@github.com>2020-10-05 20:35:51 +1100
commitf632b3b6e734670a4d21b2a5c7b23131e418077d (patch)
tree0c5d952ebb0957d26599bcda2b5f1b0439ab2980 /cli/rt/10_dispatch_minimal.js
parent8d00c32ee2e159ff8b833bf108e6e89c564ef562 (diff)
fix(core): handle unregistered errors in core better (#7817)
Diffstat (limited to 'cli/rt/10_dispatch_minimal.js')
-rw-r--r--cli/rt/10_dispatch_minimal.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/rt/10_dispatch_minimal.js b/cli/rt/10_dispatch_minimal.js
index a843d4a9e..dceb23e5f 100644
--- a/cli/rt/10_dispatch_minimal.js
+++ b/cli/rt/10_dispatch_minimal.js
@@ -50,7 +50,13 @@
function unwrapResponse(res) {
if (res.err != null) {
- throw new (core.getErrorClass(res.err.className))(res.err.message);
+ const ErrorClass = core.getErrorClass(res.err.className);
+ if (!ErrorClass) {
+ throw new Error(
+ `Unregistered error class: "${res.err.className}"\n ${res.err.message}\n Classes of errors returned from ops should be registered via Deno.core.registerErrorClass().`,
+ );
+ }
+ throw new ErrorClass(res.err.message);
}
return res.result;
}