redis-smq-common
Version:
Provides essential components and utilities shared across RedisSMQ packages.
34 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RedisSMQError = void 0;
class RedisSMQError extends Error {
constructor(...args) {
var _a, _b, _c;
const ctor = new.target;
const { defaultMessage, code } = ctor.props();
const options = (_a = args[0]) !== null && _a !== void 0 ? _a : {};
super((_b = options.message) !== null && _b !== void 0 ? _b : defaultMessage);
this.code = code;
this.metadata = (_c = options.metadata) !== null && _c !== void 0 ? _c : 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,
};
}
}
exports.RedisSMQError = RedisSMQError;
//# sourceMappingURL=redis-smq.error.js.map