@kingdom-sdk/core
Version:
Core module to design DDD applications in TypeScript
32 lines (27 loc) • 765 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.KingdomError = void 0;
/**
* Base application error class.
*
* Extends directly to global base ErrorConstructor.
* Intellisense may fail and doesn't show the inherited fields from Error interface.
*
* @property {string} name - Error class name.
* @property {string} message - Error message.
* @property {string} code - Standartized error code.
* @property {string?} stack - Error Stack trace.
*/
class KingdomError extends Error {
constructor(message, code) {
super(message);
this.name = this.constructor.name;
this.code = code;
}
toString() {
return `${this.name}: ${this.message} [${this.code}]`;
}
}
exports.KingdomError = KingdomError;
;