libmodulor
Version:
A TypeScript library to create platform-agnostic applications
14 lines (13 loc) • 366 B
JavaScript
export class CustomError extends Error {
static ERROR_UNKNOWN = 'An unexpected error occurred';
constructor(message) {
super(message ?? CustomError.ERROR_UNKNOWN);
this.name = 'CustomError';
Object.setPrototypeOf(this, CustomError.prototype);
}
toObj() {
return {
message: this.message,
};
}
}