diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2018-10-08 10:33:30 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-07 22:52:27 -0400 |
commit | ffb41e61f138a683aac5fd89e0dd72b720c929d6 (patch) | |
tree | f1158707336a51744882d733111c4da5e5583bd9 /js/errors.ts | |
parent | 1aa7e18ba329cf226d4be3104c726774eff8376c (diff) |
Updates to js to clean up default library
Diffstat (limited to 'js/errors.ts')
-rw-r--r-- | js/errors.ts | 18 |
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()!); |