diff options
author | Nayeem Rahman <muhammed.9939@gmail.com> | 2020-02-29 18:04:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 19:04:10 +0100 |
commit | 1f9d158bdc212e8cb15b92039c9cd11884c9708c (patch) | |
tree | 4c89fc3bb84c793f18ba8c5509ebf4dd1f6781ba /cli/js/dispatch_json.ts | |
parent | f55b22e195ff0dfaf117aaef2a0fcc51fe0058c8 (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_json.ts')
-rw-r--r-- | cli/js/dispatch_json.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/js/dispatch_json.ts b/cli/js/dispatch_json.ts index 12c2d8821..63789044c 100644 --- a/cli/js/dispatch_json.ts +++ b/cli/js/dispatch_json.ts @@ -3,7 +3,7 @@ import * as util from "./util.ts"; import { TextEncoder, TextDecoder } from "./text_encoding.ts"; import { core } from "./core.ts"; import { OPS_CACHE } from "./runtime.ts"; -import { ErrorKind, constructError } from "./errors.ts"; +import { ErrorKind, getErrorClass } from "./errors.ts"; // eslint-disable-next-line @typescript-eslint/no-explicit-any type Ok = any; @@ -38,7 +38,7 @@ function encode(args: object): Uint8Array { function unwrapResponse(res: JsonResponse): Ok { if (res.err != null) { - return constructError(res.err!.kind, res.err!.message); + throw new (getErrorClass(res.err.kind))(res.err.message); } util.assert(res.ok != null); return res.ok; |