diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-09-09 19:28:56 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-09-09 23:12:22 -0400 |
commit | 8090fb252b434db986256651304cab04e0d426f8 (patch) | |
tree | 2d0065530e0762e4952287f8628a7de9ae7ecbed /js/errors.ts | |
parent | a4f1b367b9314b1526c51dad593cac1682ef996b (diff) |
Expose deno.ErrorKind
Originally we planned to have a JS class for each error code. But it
seems better to just have a single DenoError class with a "kind"
property. One nice thing about using an enum instead of classes for
errors is that switch() can be used during error handling instead of a
bunch of instanceof branches.
Diffstat (limited to 'js/errors.ts')
-rw-r--r-- | js/errors.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/js/errors.ts b/js/errors.ts index ad7b6be21..d0254ef65 100644 --- a/js/errors.ts +++ b/js/errors.ts @@ -1,10 +1,11 @@ import * as fbs from "gen/msg_generated"; +export { ErrorKind } from "gen/msg_generated"; // @internal export class DenoError<T extends fbs.ErrorKind> extends Error { constructor(readonly kind: T, msg: string) { super(msg); - this.name = `deno.${fbs.ErrorKind[kind]}`; + this.name = fbs.ErrorKind[kind]; } } |