From 3a5191b33923600b58076768ef77c471d2bb60b1 Mon Sep 17 00:00:00 2001 From: Rafa Mel Date: Sat, 27 Apr 2019 01:17:56 +0200 Subject: [PATCH] feat(utils/errors): adds custom name getter for error classes --- src/utils/errors.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 027ffec..9559577 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -2,9 +2,17 @@ import { scope, Errorish } from 'errorish'; export class CustomError extends Errorish {} -export class OpenError extends CustomError {} +export class OpenError extends CustomError { + public get name(): string { + return 'OpenError'; + } +} -export class WrappedError extends CustomError {} +export class WrappedError extends CustomError { + public get name(): string { + return 'WrappedError'; + } +} export const open = scope.set('_kpo_open_', { Error: CustomError,