From ffb41e61f138a683aac5fd89e0dd72b720c929d6 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 8 Oct 2018 10:33:30 +1100 Subject: Updates to js to clean up default library --- js/errors.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'js/errors.ts') 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 extends Error { - constructor(readonly kind: T, errStr: string) { - super(errStr); - this.name = msg.ErrorKind[kind]; +export class DenoError 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 { +// @internal +export function maybeError(base: Base): null | DenoError { const kind = base.errorKind(); - if (kind === msg.ErrorKind.NoError) { + if (kind === ErrorKind.NoError) { return null; } else { return new DenoError(kind, base.error()!); -- cgit v1.2.3