problem-details
Version:
HTTP problem details model based on RFC7807
43 lines • 2.03 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ProblemDetail = /** @class */ (function (_super) {
__extends(ProblemDetail, _super);
/**
* Creates a new problemdetail error object
* @param type URI reference [RFC3986] that identifies the problem type
* @param title Short human readable summary of the problem type
* @param status HTTP status code generated by the origin server
* @param identifier Unique identifier to easily find the error in the logs
* @param code Error code that maps 1 to 1 with tyep type developers can program with
*/
function ProblemDetail(type, title, status, identifier, code) {
var _this = _super.call(this, title) || this;
// see: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(_this, ProblemDetail.prototype);
// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
Error.captureStackTrace(_this, ProblemDetail);
_this.name = 'ProblemDetail';
_this.type = type;
_this.title = title;
_this.status = status;
_this.identifier = identifier;
_this.code = code;
return _this;
}
return ProblemDetail;
}(Error));
exports.ProblemDetail = ProblemDetail;
//# sourceMappingURL=problem-detail.js.map