This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Base error class that all application errors should extend. | |
* | |
* Like the native `Error`, but ensures subclasses are properly initialised and correctly typed. | |
*/ | |
export class BaseError extends Error { | |
constructor(message: string) { | |
super(message); | |
Object.defineProperty(this, "name", { value: new.target.name }); | |
Object.setPrototypeOf(this, new.target.prototype); |