redis-smq-common
Version:
Provides essential components and utilities shared across RedisSMQ packages.
31 lines • 796 B
JavaScript
export class RedisSMQError extends Error {
code;
metadata;
constructor(...args) {
const ctor = new.target;
const { defaultMessage, code } = ctor.props();
const options = args[0] ?? {};
super(options.message ?? defaultMessage);
this.code = code;
this.metadata = options.metadata ?? null;
}
getMetadata() {
return this.metadata;
}
get name() {
return this.constructor.name;
}
static get props() {
return this.prototype.getProps;
}
toJSON() {
return {
name: this.name,
code: this.code,
message: this.message,
metadata: this.metadata,
stack: this.stack,
};
}
}
//# sourceMappingURL=redis-smq.error.js.map