summaryrefslogtreecommitdiff
path: root/cli/js/dispatch_minimal.ts
diff options
context:
space:
mode:
authorNayeem Rahman <muhammed.9939@gmail.com>2020-02-29 18:04:10 +0000
committerGitHub <noreply@github.com>2020-02-29 19:04:10 +0100
commit1f9d158bdc212e8cb15b92039c9cd11884c9708c (patch)
tree4c89fc3bb84c793f18ba8c5509ebf4dd1f6781ba /cli/js/dispatch_minimal.ts
parentf55b22e195ff0dfaf117aaef2a0fcc51fe0058c8 (diff)
refactor(cli/js): Replace constructError() with getErrorClass() (#4189)
Flattens dispatch error handling to produce one less useless stack frame on op errors.
Diffstat (limited to 'cli/js/dispatch_minimal.ts')
-rw-r--r--cli/js/dispatch_minimal.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/js/dispatch_minimal.ts b/cli/js/dispatch_minimal.ts
index 988cb8af2..5778b1333 100644
--- a/cli/js/dispatch_minimal.ts
+++ b/cli/js/dispatch_minimal.ts
@@ -2,7 +2,7 @@
import * as util from "./util.ts";
import { core } from "./core.ts";
import { TextDecoder } from "./text_encoding.ts";
-import { errors, ErrorKind, constructError } from "./errors.ts";
+import { ErrorKind, errors, getErrorClass } from "./errors.ts";
const promiseTableMin = new Map<number, util.Resolvable<RecordMinimal>>();
// Note it's important that promiseId starts at 1 instead of 0, because sync
@@ -56,7 +56,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal {
function unwrapResponse(res: RecordMinimal): number {
if (res.err != null) {
- return constructError(res.err!.kind, res.err!.message);
+ throw new (getErrorClass(res.err.kind))(res.err.message);
}
return res.result;
}