Skip to content

Commit

Permalink
feat(utils/errors): adds custom name getter for error classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 26, 2019
1 parent dc341f4 commit 3a5191b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ import { scope, Errorish } from 'errorish';

export class CustomError<T> extends Errorish<T> {}

export class OpenError<T> extends CustomError<T> {}
export class OpenError<T> extends CustomError<T> {
public get name(): string {
return 'OpenError';
}
}

export class WrappedError<T> extends CustomError<T> {}
export class WrappedError<T> extends CustomError<T> {
public get name(): string {
return 'WrappedError';
}
}

export const open = scope.set('_kpo_open_', {
Error: CustomError,
Expand Down

0 comments on commit 3a5191b

Please sign in to comment.