refactor: remove unneeded ErrorKinds (#3936)

This commit is contained in:
Bartek Iwańczuk 2020-02-21 10:36:13 -05:00 committed by GitHub
parent d9efb8c02a
commit dd8a109481
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 553 additions and 620 deletions

View file

@ -2,7 +2,7 @@
import * as util from "./util.ts";
import { TextEncoder, TextDecoder } from "./text_encoding.ts";
import { core } from "./core.ts";
import { ErrorKind, DenoError } from "./errors.ts";
import { ErrorKind, constructError } from "./errors.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Ok = any;
@ -37,7 +37,7 @@ function encode(args: object): Uint8Array {
function unwrapResponse(res: JsonResponse): Ok {
if (res.err != null) {
throw new DenoError(res.err!.kind, res.err!.message);
return constructError(res.err!.kind, res.err!.message);
}
util.assert(res.ok != null);
return res.ok;