diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-21 10:36:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 10:36:13 -0500 |
commit | dd8a10948195f231a6a9eb652e3f208813904ad6 (patch) | |
tree | f9a4afeb67bbead882c29c2458a5f1f99e2e42db /cli/js/dispatch_minimal.ts | |
parent | d9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff) |
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'cli/js/dispatch_minimal.ts')
-rw-r--r-- | cli/js/dispatch_minimal.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/js/dispatch_minimal.ts b/cli/js/dispatch_minimal.ts index 1ce3fbaef..203701085 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 { ErrorKind, DenoError } from "./errors.ts"; +import { Err, ErrorKind, constructError } 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 @@ -43,7 +43,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal { const message = decoder.decode(ui8.slice(12)); err = { kind, message }; } else if (ui8.length != 12) { - err = { kind: ErrorKind.InvalidData, message: "Bad message" }; + throw new Err.InvalidData("BadMessage"); } return { @@ -56,7 +56,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal { function unwrapResponse(res: RecordMinimal): number { if (res.err != null) { - throw new DenoError(res.err!.kind, res.err!.message); + return constructError(res.err!.kind, res.err!.message); } return res.result; } |