mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
refactor(cli/js): Replace constructError() with getErrorClass() (#4189)
Flattens dispatch error handling to produce one less useless stack frame on op errors.
This commit is contained in:
parent
f55b22e195
commit
1f9d158bdc
10 changed files with 32 additions and 39 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue