Skip to content

Commit

Permalink
feat(utils/errors): adds SilentError
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed May 8, 2019
1 parent 2a3837f commit c72844d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export class OpenError<T> extends KpoError<T> {
}
}

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

export function open(source?: any): KpoError<any> {
return isKpoError(source) ? source : new OpenError(undefined, source);
}
Expand All @@ -56,3 +62,7 @@ export function isKpoError(err: any): err is KpoError<any> {
export function isOpenError(err: any): err is OpenError<any> {
return isKpoError(err) && err.name === 'OpenError';
}

export function isSilentError(err: any): err is OpenError<any> {
return isKpoError(err) && err.name === 'SilentError';
}

0 comments on commit c72844d

Please sign in to comment.