realm-object-server
Version:
43 lines • 1.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class JSONError extends Error {
constructor(params = {}) {
super();
this.status = 400;
if (params.type) {
this.type = params.type;
}
if (params.title) {
this.title = params.title;
}
if (params.status) {
this.status = params.status;
}
if (params.detail) {
this.detail = params.detail;
}
if (params.instance) {
this.instance = params.instance;
}
if (params.stack) {
this.stack = params.stack;
}
else if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, this.constructor);
}
}
toJSON() {
return {
type: this.type,
title: this.title,
status: this.status,
detail: this.detail,
instance: this.instance,
};
}
get message() {
return this.title;
}
}
exports.JSONError = JSONError;
//# sourceMappingURL=JSONError.js.map