http-errors-enhanced-cjs
Version:
Create HTTP errors with additional properties for any framework.
590 lines (589 loc) • 18.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
BadGatewayError: null,
BadRequestError: null,
BandwidthLimitExceededError: null,
ConflictError: null,
ExpectationFailedError: null,
FailedDependencyError: null,
ForbiddenError: null,
GatewayTimeoutError: null,
GoneError: null,
HTTPVersionNotSupportedError: null,
ImaTeapotError: null,
InsufficientStorageError: null,
InternalServerError: null,
LengthRequiredError: null,
LockedError: null,
LoopDetectedError: null,
MethodNotAllowedError: null,
MisdirectedRequestError: null,
NetworkAuthenticationRequiredError: null,
NotAcceptableError: null,
NotExtendedError: null,
NotFoundError: null,
NotImplementedError: null,
PayloadTooLargeError: null,
PaymentRequiredError: null,
PreconditionFailedError: null,
PreconditionRequiredError: null,
ProxyAuthenticationRequiredError: null,
RangeNotSatisfiableError: null,
RequestHeaderFieldsTooLargeError: null,
RequestTimeoutError: null,
ServiceUnavailableError: null,
TooEarlyError: null,
TooManyRequestsError: null,
URITooLongError: null,
UnauthorizedError: null,
UnavailableForLegalReasonsError: null,
UnprocessableEntityError: null,
UnsupportedMediaTypeError: null,
UpgradeRequiredError: null,
VariantAlsoNegotiatesError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
BadGatewayError: function() {
return BadGatewayError;
},
BadRequestError: function() {
return BadRequestError;
},
BandwidthLimitExceededError: function() {
return BandwidthLimitExceededError;
},
ConflictError: function() {
return ConflictError;
},
ExpectationFailedError: function() {
return ExpectationFailedError;
},
FailedDependencyError: function() {
return FailedDependencyError;
},
ForbiddenError: function() {
return ForbiddenError;
},
GatewayTimeoutError: function() {
return GatewayTimeoutError;
},
GoneError: function() {
return GoneError;
},
HTTPVersionNotSupportedError: function() {
return HTTPVersionNotSupportedError;
},
ImaTeapotError: function() {
return ImaTeapotError;
},
InsufficientStorageError: function() {
return InsufficientStorageError;
},
InternalServerError: function() {
return InternalServerError;
},
LengthRequiredError: function() {
return LengthRequiredError;
},
LockedError: function() {
return LockedError;
},
LoopDetectedError: function() {
return LoopDetectedError;
},
MethodNotAllowedError: function() {
return MethodNotAllowedError;
},
MisdirectedRequestError: function() {
return MisdirectedRequestError;
},
NetworkAuthenticationRequiredError: function() {
return NetworkAuthenticationRequiredError;
},
NotAcceptableError: function() {
return NotAcceptableError;
},
NotExtendedError: function() {
return NotExtendedError;
},
NotFoundError: function() {
return NotFoundError;
},
NotImplementedError: function() {
return NotImplementedError;
},
PayloadTooLargeError: function() {
return PayloadTooLargeError;
},
PaymentRequiredError: function() {
return PaymentRequiredError;
},
PreconditionFailedError: function() {
return PreconditionFailedError;
},
PreconditionRequiredError: function() {
return PreconditionRequiredError;
},
ProxyAuthenticationRequiredError: function() {
return ProxyAuthenticationRequiredError;
},
RangeNotSatisfiableError: function() {
return RangeNotSatisfiableError;
},
RequestHeaderFieldsTooLargeError: function() {
return RequestHeaderFieldsTooLargeError;
},
RequestTimeoutError: function() {
return RequestTimeoutError;
},
ServiceUnavailableError: function() {
return ServiceUnavailableError;
},
TooEarlyError: function() {
return TooEarlyError;
},
TooManyRequestsError: function() {
return TooManyRequestsError;
},
URITooLongError: function() {
return URITooLongError;
},
UnauthorizedError: function() {
return UnauthorizedError;
},
UnavailableForLegalReasonsError: function() {
return UnavailableForLegalReasonsError;
},
UnprocessableEntityError: function() {
return UnprocessableEntityError;
},
UnsupportedMediaTypeError: function() {
return UnsupportedMediaTypeError;
},
UpgradeRequiredError: function() {
return UpgradeRequiredError;
},
VariantAlsoNegotiatesError: function() {
return VariantAlsoNegotiatesError;
}
});
const _base = require("./base.js");
class BadRequestError extends _base.HttpError {
static status = 400;
static error = 'BadRequest';
static message = 'Bad Request';
static phrase = 'Bad request.';
constructor(message, properties){
super(400, message, properties);
this.name = 'BadRequestError';
}
}
class UnauthorizedError extends _base.HttpError {
static status = 401;
static error = 'Unauthorized';
static message = 'Unauthorized';
static phrase = 'Unauthorized.';
constructor(message, properties){
super(401, message, properties);
this.name = 'UnauthorizedError';
}
}
class PaymentRequiredError extends _base.HttpError {
static status = 402;
static error = 'PaymentRequired';
static message = 'Payment Required';
static phrase = 'Payment required.';
constructor(message, properties){
super(402, message, properties);
this.name = 'PaymentRequiredError';
}
}
class ForbiddenError extends _base.HttpError {
static status = 403;
static error = 'Forbidden';
static message = 'Forbidden';
static phrase = 'Forbidden.';
constructor(message, properties){
super(403, message, properties);
this.name = 'ForbiddenError';
}
}
class NotFoundError extends _base.HttpError {
static status = 404;
static error = 'NotFound';
static message = 'Not Found';
static phrase = 'Not found.';
constructor(message, properties){
super(404, message, properties);
this.name = 'NotFoundError';
}
}
class MethodNotAllowedError extends _base.HttpError {
static status = 405;
static error = 'MethodNotAllowed';
static message = 'Method Not Allowed';
static phrase = 'Method not allowed.';
constructor(message, properties){
super(405, message, properties);
this.name = 'MethodNotAllowedError';
}
}
class NotAcceptableError extends _base.HttpError {
static status = 406;
static error = 'NotAcceptable';
static message = 'Not Acceptable';
static phrase = 'Not acceptable.';
constructor(message, properties){
super(406, message, properties);
this.name = 'NotAcceptableError';
}
}
class ProxyAuthenticationRequiredError extends _base.HttpError {
static status = 407;
static error = 'ProxyAuthenticationRequired';
static message = 'Proxy Authentication Required';
static phrase = 'Proxy authentication required.';
constructor(message, properties){
super(407, message, properties);
this.name = 'ProxyAuthenticationRequiredError';
}
}
class RequestTimeoutError extends _base.HttpError {
static status = 408;
static error = 'RequestTimeout';
static message = 'Request Timeout';
static phrase = 'Request timeout.';
constructor(message, properties){
super(408, message, properties);
this.name = 'RequestTimeoutError';
}
}
class ConflictError extends _base.HttpError {
static status = 409;
static error = 'Conflict';
static message = 'Conflict';
static phrase = 'Conflict.';
constructor(message, properties){
super(409, message, properties);
this.name = 'ConflictError';
}
}
class GoneError extends _base.HttpError {
static status = 410;
static error = 'Gone';
static message = 'Gone';
static phrase = 'Gone.';
constructor(message, properties){
super(410, message, properties);
this.name = 'GoneError';
}
}
class LengthRequiredError extends _base.HttpError {
static status = 411;
static error = 'LengthRequired';
static message = 'Length Required';
static phrase = 'Length required.';
constructor(message, properties){
super(411, message, properties);
this.name = 'LengthRequiredError';
}
}
class PreconditionFailedError extends _base.HttpError {
static status = 412;
static error = 'PreconditionFailed';
static message = 'Precondition Failed';
static phrase = 'Precondition failed.';
constructor(message, properties){
super(412, message, properties);
this.name = 'PreconditionFailedError';
}
}
class PayloadTooLargeError extends _base.HttpError {
static status = 413;
static error = 'PayloadTooLarge';
static message = 'Payload Too Large';
static phrase = 'Payload too large.';
constructor(message, properties){
super(413, message, properties);
this.name = 'PayloadTooLargeError';
}
}
class URITooLongError extends _base.HttpError {
static status = 414;
static error = 'URITooLong';
static message = 'URI Too Long';
static phrase = 'Uri too long.';
constructor(message, properties){
super(414, message, properties);
this.name = 'URITooLongError';
}
}
class UnsupportedMediaTypeError extends _base.HttpError {
static status = 415;
static error = 'UnsupportedMediaType';
static message = 'Unsupported Media Type';
static phrase = 'Unsupported media type.';
constructor(message, properties){
super(415, message, properties);
this.name = 'UnsupportedMediaTypeError';
}
}
class RangeNotSatisfiableError extends _base.HttpError {
static status = 416;
static error = 'RangeNotSatisfiable';
static message = 'Range Not Satisfiable';
static phrase = 'Range not satisfiable.';
constructor(message, properties){
super(416, message, properties);
this.name = 'RangeNotSatisfiableError';
}
}
class ExpectationFailedError extends _base.HttpError {
static status = 417;
static error = 'ExpectationFailed';
static message = 'Expectation Failed';
static phrase = 'Expectation failed.';
constructor(message, properties){
super(417, message, properties);
this.name = 'ExpectationFailedError';
}
}
class ImaTeapotError extends _base.HttpError {
static status = 418;
static error = 'ImaTeapot';
static message = "I'm a Teapot";
static phrase = "I'm a teapot.";
constructor(message, properties){
super(418, message, properties);
this.name = 'ImaTeapotError';
}
}
class MisdirectedRequestError extends _base.HttpError {
static status = 421;
static error = 'MisdirectedRequest';
static message = 'Misdirected Request';
static phrase = 'Misdirected request.';
constructor(message, properties){
super(421, message, properties);
this.name = 'MisdirectedRequestError';
}
}
class UnprocessableEntityError extends _base.HttpError {
static status = 422;
static error = 'UnprocessableEntity';
static message = 'Unprocessable Entity';
static phrase = 'Unprocessable entity.';
constructor(message, properties){
super(422, message, properties);
this.name = 'UnprocessableEntityError';
}
}
class LockedError extends _base.HttpError {
static status = 423;
static error = 'Locked';
static message = 'Locked';
static phrase = 'Locked.';
constructor(message, properties){
super(423, message, properties);
this.name = 'LockedError';
}
}
class FailedDependencyError extends _base.HttpError {
static status = 424;
static error = 'FailedDependency';
static message = 'Failed Dependency';
static phrase = 'Failed dependency.';
constructor(message, properties){
super(424, message, properties);
this.name = 'FailedDependencyError';
}
}
class TooEarlyError extends _base.HttpError {
static status = 425;
static error = 'TooEarly';
static message = 'Too Early';
static phrase = 'Too early.';
constructor(message, properties){
super(425, message, properties);
this.name = 'TooEarlyError';
}
}
class UpgradeRequiredError extends _base.HttpError {
static status = 426;
static error = 'UpgradeRequired';
static message = 'Upgrade Required';
static phrase = 'Upgrade required.';
constructor(message, properties){
super(426, message, properties);
this.name = 'UpgradeRequiredError';
}
}
class PreconditionRequiredError extends _base.HttpError {
static status = 428;
static error = 'PreconditionRequired';
static message = 'Precondition Required';
static phrase = 'Precondition required.';
constructor(message, properties){
super(428, message, properties);
this.name = 'PreconditionRequiredError';
}
}
class TooManyRequestsError extends _base.HttpError {
static status = 429;
static error = 'TooManyRequests';
static message = 'Too Many Requests';
static phrase = 'Too many requests.';
constructor(message, properties){
super(429, message, properties);
this.name = 'TooManyRequestsError';
}
}
class RequestHeaderFieldsTooLargeError extends _base.HttpError {
static status = 431;
static error = 'RequestHeaderFieldsTooLarge';
static message = 'Request Header Fields Too Large';
static phrase = 'Request header fields too large.';
constructor(message, properties){
super(431, message, properties);
this.name = 'RequestHeaderFieldsTooLargeError';
}
}
class UnavailableForLegalReasonsError extends _base.HttpError {
static status = 451;
static error = 'UnavailableForLegalReasons';
static message = 'Unavailable For Legal Reasons';
static phrase = 'Unavailable for legal reasons.';
constructor(message, properties){
super(451, message, properties);
this.name = 'UnavailableForLegalReasonsError';
}
}
class InternalServerError extends _base.HttpError {
static status = 500;
static error = 'InternalServerError';
static message = 'Internal Server Error';
static phrase = 'Internal server error.';
constructor(message, properties){
super(500, message, properties);
this.name = 'InternalServerError';
}
}
class NotImplementedError extends _base.HttpError {
static status = 501;
static error = 'NotImplemented';
static message = 'Not Implemented';
static phrase = 'Not implemented.';
constructor(message, properties){
super(501, message, properties);
this.name = 'NotImplementedError';
}
}
class BadGatewayError extends _base.HttpError {
static status = 502;
static error = 'BadGateway';
static message = 'Bad Gateway';
static phrase = 'Bad gateway.';
constructor(message, properties){
super(502, message, properties);
this.name = 'BadGatewayError';
}
}
class ServiceUnavailableError extends _base.HttpError {
static status = 503;
static error = 'ServiceUnavailable';
static message = 'Service Unavailable';
static phrase = 'Service unavailable.';
constructor(message, properties){
super(503, message, properties);
this.name = 'ServiceUnavailableError';
}
}
class GatewayTimeoutError extends _base.HttpError {
static status = 504;
static error = 'GatewayTimeout';
static message = 'Gateway Timeout';
static phrase = 'Gateway timeout.';
constructor(message, properties){
super(504, message, properties);
this.name = 'GatewayTimeoutError';
}
}
class HTTPVersionNotSupportedError extends _base.HttpError {
static status = 505;
static error = 'HTTPVersionNotSupported';
static message = 'HTTP Version Not Supported';
static phrase = 'Http version not supported.';
constructor(message, properties){
super(505, message, properties);
this.name = 'HTTPVersionNotSupportedError';
}
}
class VariantAlsoNegotiatesError extends _base.HttpError {
static status = 506;
static error = 'VariantAlsoNegotiates';
static message = 'Variant Also Negotiates';
static phrase = 'Variant also negotiates.';
constructor(message, properties){
super(506, message, properties);
this.name = 'VariantAlsoNegotiatesError';
}
}
class InsufficientStorageError extends _base.HttpError {
static status = 507;
static error = 'InsufficientStorage';
static message = 'Insufficient Storage';
static phrase = 'Insufficient storage.';
constructor(message, properties){
super(507, message, properties);
this.name = 'InsufficientStorageError';
}
}
class LoopDetectedError extends _base.HttpError {
static status = 508;
static error = 'LoopDetected';
static message = 'Loop Detected';
static phrase = 'Loop detected.';
constructor(message, properties){
super(508, message, properties);
this.name = 'LoopDetectedError';
}
}
class BandwidthLimitExceededError extends _base.HttpError {
static status = 509;
static error = 'BandwidthLimitExceeded';
static message = 'Bandwidth Limit Exceeded';
static phrase = 'Bandwidth limit exceeded.';
constructor(message, properties){
super(509, message, properties);
this.name = 'BandwidthLimitExceededError';
}
}
class NotExtendedError extends _base.HttpError {
static status = 510;
static error = 'NotExtended';
static message = 'Not Extended';
static phrase = 'Not extended.';
constructor(message, properties){
super(510, message, properties);
this.name = 'NotExtendedError';
}
}
class NetworkAuthenticationRequiredError extends _base.HttpError {
static status = 511;
static error = 'NetworkAuthenticationRequired';
static message = 'Network Authentication Required';
static phrase = 'Network authentication required.';
constructor(message, properties){
super(511, message, properties);
this.name = 'NetworkAuthenticationRequiredError';
}
}