@acruzjr/express-http-errors
Version:
The easiest way to handle errors in Express.
427 lines • 14.6 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkAuthenticationRequiredError = exports.NotExtendedError = exports.BandwidthLimitExceededError = exports.LoopDetectedError = exports.InsufficientStorageError = exports.VariantAlsoNegotiatesError = exports.HTTPVersionNotSupportedError = exports.GatewayTimeoutError = exports.ServiceUnavailableError = exports.BadGatewayError = exports.NotImplementedError = exports.InternalServerError = exports.UnavailableForLegalReasonsError = exports.RequestHeaderFieldsTooLargeError = exports.TooManyRequestsError = exports.PreconditionRequiredError = exports.UpgradeRequiredError = exports.TooEarlyError = exports.FailedDependencyError = exports.LockedError = exports.UnprocessableEntityError = exports.MisdirectedRequestError = exports.ImATeapotError = exports.ExpectationFailedError = exports.RangeNotSatisfiableError = exports.UnsupportedMediaTypeError = exports.URITooLongError = exports.PayloadTooLargeError = exports.PreconditionFailedError = exports.LengthRequiredError = exports.GoneError = exports.ConflictError = exports.RequestTimeoutError = exports.ProxyAuthenticationRequiredError = exports.NotAcceptableError = exports.MethodNotAllowedError = exports.NotFoundError = exports.ForbiddenError = exports.PaymentRequiredError = exports.UnauthorizedError = exports.BadRequestError = void 0;
const HttpError_1 = require("./HttpError");
__exportStar(require("./HttpError"), exports);
__exportStar(require("./express-error-handler"), exports);
class BadRequestError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 400;
this.error = error;
this.name = 'BadRequestError';
this.postBuild();
}
}
exports.BadRequestError = BadRequestError;
class UnauthorizedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 401;
this.error = error;
this.name = 'UnauthorizedError';
this.postBuild();
}
}
exports.UnauthorizedError = UnauthorizedError;
class PaymentRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 402;
this.error = error;
this.name = 'PaymentRequiredError';
this.postBuild();
}
}
exports.PaymentRequiredError = PaymentRequiredError;
class ForbiddenError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 403;
this.error = error;
this.name = 'ForbiddenError';
this.postBuild();
}
}
exports.ForbiddenError = ForbiddenError;
class NotFoundError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 404;
this.error = error;
this.name = 'NotFoundError';
this.postBuild();
}
}
exports.NotFoundError = NotFoundError;
class MethodNotAllowedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 405;
this.error = error;
this.name = 'MethodNotAllowedError';
this.postBuild();
}
}
exports.MethodNotAllowedError = MethodNotAllowedError;
class NotAcceptableError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 406;
this.error = error;
this.name = 'NotAcceptableError';
this.postBuild();
}
}
exports.NotAcceptableError = NotAcceptableError;
class ProxyAuthenticationRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 407;
this.error = error;
this.name = 'ProxyAuthenticationRequiredError';
this.postBuild();
}
}
exports.ProxyAuthenticationRequiredError = ProxyAuthenticationRequiredError;
class RequestTimeoutError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 408;
this.error = error;
this.name = 'RequestTimeoutError';
this.postBuild();
}
}
exports.RequestTimeoutError = RequestTimeoutError;
class ConflictError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 409;
this.error = error;
this.name = 'ConflictError';
this.postBuild();
}
}
exports.ConflictError = ConflictError;
class GoneError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 410;
this.error = error;
this.name = 'GoneError';
this.postBuild();
}
}
exports.GoneError = GoneError;
class LengthRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 411;
this.error = error;
this.name = 'LengthRequiredError';
this.postBuild();
}
}
exports.LengthRequiredError = LengthRequiredError;
class PreconditionFailedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 412;
this.error = error;
this.name = 'PreconditionFailedError';
this.postBuild();
}
}
exports.PreconditionFailedError = PreconditionFailedError;
class PayloadTooLargeError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 413;
this.error = error;
this.name = 'PayloadTooLargeError';
this.postBuild();
}
}
exports.PayloadTooLargeError = PayloadTooLargeError;
class URITooLongError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 414;
this.error = error;
this.name = 'URITooLongError';
this.postBuild();
}
}
exports.URITooLongError = URITooLongError;
class UnsupportedMediaTypeError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 415;
this.error = error;
this.name = 'UnsupportedMediaTypeError';
this.postBuild();
}
}
exports.UnsupportedMediaTypeError = UnsupportedMediaTypeError;
class RangeNotSatisfiableError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 416;
this.error = error;
this.name = 'RangeNotSatisfiableError';
this.postBuild();
}
}
exports.RangeNotSatisfiableError = RangeNotSatisfiableError;
class ExpectationFailedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 417;
this.error = error;
this.name = 'ExpectationFailedError';
this.postBuild();
}
}
exports.ExpectationFailedError = ExpectationFailedError;
class ImATeapotError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 418;
this.error = error;
this.name = 'ImATeapotError';
this.postBuild();
}
}
exports.ImATeapotError = ImATeapotError;
class MisdirectedRequestError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 421;
this.error = error;
this.name = 'MisdirectedRequestError';
this.postBuild();
}
}
exports.MisdirectedRequestError = MisdirectedRequestError;
class UnprocessableEntityError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 422;
this.error = error;
this.name = 'UnprocessableEntityError';
this.postBuild();
}
}
exports.UnprocessableEntityError = UnprocessableEntityError;
class LockedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 423;
this.error = error;
this.name = 'LockedError';
this.postBuild();
}
}
exports.LockedError = LockedError;
class FailedDependencyError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 424;
this.error = error;
this.name = 'FailedDependencyError';
this.postBuild();
}
}
exports.FailedDependencyError = FailedDependencyError;
class TooEarlyError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 425;
this.error = error;
this.name = 'TooEarlyError';
this.postBuild();
}
}
exports.TooEarlyError = TooEarlyError;
class UpgradeRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 426;
this.error = error;
this.name = 'UpgradeRequiredError';
this.postBuild();
}
}
exports.UpgradeRequiredError = UpgradeRequiredError;
class PreconditionRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 428;
this.error = error;
this.name = 'PreconditionRequiredError';
this.postBuild();
}
}
exports.PreconditionRequiredError = PreconditionRequiredError;
class TooManyRequestsError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 429;
this.error = error;
this.name = 'TooManyRequestsError';
this.postBuild();
}
}
exports.TooManyRequestsError = TooManyRequestsError;
class RequestHeaderFieldsTooLargeError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 431;
this.error = error;
this.name = 'RequestHeaderFieldsTooLargeError';
this.postBuild();
}
}
exports.RequestHeaderFieldsTooLargeError = RequestHeaderFieldsTooLargeError;
class UnavailableForLegalReasonsError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 451;
this.error = error;
this.name = 'UnavailableForLegalReasonsError';
this.postBuild();
}
}
exports.UnavailableForLegalReasonsError = UnavailableForLegalReasonsError;
class InternalServerError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 500;
this.error = error;
this.name = 'InternalServerError';
this.postBuild();
}
}
exports.InternalServerError = InternalServerError;
class NotImplementedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 501;
this.error = error;
this.name = 'NotImplementedError';
this.postBuild();
}
}
exports.NotImplementedError = NotImplementedError;
class BadGatewayError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 502;
this.error = error;
this.name = 'BadGatewayError';
this.postBuild();
}
}
exports.BadGatewayError = BadGatewayError;
class ServiceUnavailableError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 503;
this.error = error;
this.name = 'ServiceUnavailableError';
this.postBuild();
}
}
exports.ServiceUnavailableError = ServiceUnavailableError;
class GatewayTimeoutError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 504;
this.error = error;
this.name = 'GatewayTimeoutError';
this.postBuild();
}
}
exports.GatewayTimeoutError = GatewayTimeoutError;
class HTTPVersionNotSupportedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 505;
this.error = error;
this.name = 'HTTPVersionNotSupportedError';
this.postBuild();
}
}
exports.HTTPVersionNotSupportedError = HTTPVersionNotSupportedError;
class VariantAlsoNegotiatesError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 506;
this.error = error;
this.name = 'VariantAlsoNegotiatesError';
this.postBuild();
}
}
exports.VariantAlsoNegotiatesError = VariantAlsoNegotiatesError;
class InsufficientStorageError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 507;
this.error = error;
this.name = 'InsufficientStorageError';
this.postBuild();
}
}
exports.InsufficientStorageError = InsufficientStorageError;
class LoopDetectedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 508;
this.error = error;
this.name = 'LoopDetectedError';
this.postBuild();
}
}
exports.LoopDetectedError = LoopDetectedError;
class BandwidthLimitExceededError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 509;
this.error = error;
this.name = 'BandwidthLimitExceededError';
this.postBuild();
}
}
exports.BandwidthLimitExceededError = BandwidthLimitExceededError;
class NotExtendedError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 510;
this.error = error;
this.name = 'NotExtendedError';
this.postBuild();
}
}
exports.NotExtendedError = NotExtendedError;
class NetworkAuthenticationRequiredError extends HttpError_1.HttpError {
constructor(message, error) {
super(message);
this.status = 511;
this.error = error;
this.name = 'NetworkAuthenticationRequiredError';
this.postBuild();
}
}
exports.NetworkAuthenticationRequiredError = NetworkAuthenticationRequiredError;
//# sourceMappingURL=index.js.map