@rpidanny/nepse.js
Version:
Fetch stock data from Nepal Stock Exchange
29 lines • 875 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppError = void 0;
class AppError extends Error {
constructor({ code = 'AppError', message = 'General application error', details, err, } = {}) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.code = code;
this.message = message;
this.details = details;
if (err) {
this.stack = err.stack;
}
}
toJSON() {
const payload = {
code: this.code,
message: this.message,
};
if (this.details) {
payload.details = this.details;
}
return payload;
}
}
exports.AppError = AppError;
//# sourceMappingURL=app.error.js.map