summaryrefslogtreecommitdiff
path: root/js/errors.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/errors.ts')
-rw-r--r--js/errors.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/js/errors.ts b/js/errors.ts
index 72fc5f23b..d6e9713cf 100644
--- a/js/errors.ts
+++ b/js/errors.ts
@@ -1,25 +1,25 @@
-import * as msg from "gen/msg_generated";
+import { Base, ErrorKind } from "gen/msg_generated";
export { ErrorKind } from "gen/msg_generated";
-// @internal
-export class DenoError<T extends msg.ErrorKind> extends Error {
- constructor(readonly kind: T, errStr: string) {
- super(errStr);
- this.name = msg.ErrorKind[kind];
+export class DenoError<T extends ErrorKind> extends Error {
+ constructor(readonly kind: T, msg: string) {
+ super(msg);
+ this.name = ErrorKind[kind];
}
}
// @internal
-export function maybeThrowError(base: msg.Base): void {
+export function maybeThrowError(base: Base): void {
const err = maybeError(base);
if (err != null) {
throw err;
}
}
-export function maybeError(base: msg.Base): null | DenoError<msg.ErrorKind> {
+// @internal
+export function maybeError(base: Base): null | DenoError<ErrorKind> {
const kind = base.errorKind();
- if (kind === msg.ErrorKind.NoError) {
+ if (kind === ErrorKind.NoError) {
return null;
} else {
return new DenoError(kind, base.error()!);