@phaier/error
v0.0.4
Published
error
Downloads
1
Readme
@phaier/error
Usage
@phaier/error
is easiest to use when installed with npm
yarn add @phaier/error --dev
Then you can load the module into your code with a import
:
import { FailReason, FailReasonFactory } from "@phaier/error";
Create your own FailReason
Define interface.
export interface UnresolvedError extends FailReason {
exception: any;
}
Define FailReasonFactory.
export class UnresolvedErrorFactory extends FailReasonFactory<UnresolvedError> {
constructor() {
super("UnresolvedError");
}
public create(exception: any): UnresolvedError {
return {
type: this.type,
exception: exception,
};
}
}
export const UnresolvedError = new UnresolvedErrorFactory();