UNPKG

@mini2/core

Version:

Mini Express Framework - Lightweight and modular Express.js framework with TypeScript support

140 lines 4.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpiredException = exports.GatewayTimeoutException = exports.ServiceUnavailableException = exports.BadGatewayException = exports.NotImplementedException = exports.InternalServerErrorException = exports.TooManyRequestsException = exports.UnprocessableEntityException = exports.UnsupportedMediaTypeException = exports.PayloadTooLargeException = exports.PreconditionFailedException = exports.LengthRequiredException = exports.GoneException = exports.ConflictException = exports.NotAcceptableException = exports.MethodNotAllowedException = exports.NotFoundException = exports.ForbiddenException = exports.PaymentRequiredException = exports.UnauthorizedException = exports.BadRequestException = void 0; class HttpException extends Error { constructor(message, code = 500) { super(JSON.stringify(message)); this.code = code; this.message = JSON.stringify(message); this.messageJson = message; Error.captureStackTrace(this, this.constructor); } } exports.default = HttpException; class BadRequestException extends HttpException { constructor(error) { super(error, 400); } } exports.BadRequestException = BadRequestException; class UnauthorizedException extends HttpException { constructor(error) { super(error, 401); } } exports.UnauthorizedException = UnauthorizedException; class PaymentRequiredException extends HttpException { constructor(error) { super(error, 402); } } exports.PaymentRequiredException = PaymentRequiredException; class ForbiddenException extends HttpException { constructor(error) { super(error, 403); } } exports.ForbiddenException = ForbiddenException; class NotFoundException extends HttpException { constructor(error) { super(error, 404); } } exports.NotFoundException = NotFoundException; class MethodNotAllowedException extends HttpException { constructor(error) { super(error, 405); } } exports.MethodNotAllowedException = MethodNotAllowedException; class NotAcceptableException extends HttpException { constructor(error) { super(error, 406); } } exports.NotAcceptableException = NotAcceptableException; class ConflictException extends HttpException { constructor(error) { super(error, 409); } } exports.ConflictException = ConflictException; class GoneException extends HttpException { constructor(error) { super(error, 410); } } exports.GoneException = GoneException; class LengthRequiredException extends HttpException { constructor(error) { super(error, 411); } } exports.LengthRequiredException = LengthRequiredException; class PreconditionFailedException extends HttpException { constructor(error) { super(error, 412); } } exports.PreconditionFailedException = PreconditionFailedException; class PayloadTooLargeException extends HttpException { constructor(error) { super(error, 413); } } exports.PayloadTooLargeException = PayloadTooLargeException; class UnsupportedMediaTypeException extends HttpException { constructor(error) { super(error, 415); } } exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException; class UnprocessableEntityException extends HttpException { constructor(error) { super(error, 422); } } exports.UnprocessableEntityException = UnprocessableEntityException; class TooManyRequestsException extends HttpException { constructor(error) { super(error, 429); } } exports.TooManyRequestsException = TooManyRequestsException; class InternalServerErrorException extends HttpException { constructor(error) { super(error, 500); } } exports.InternalServerErrorException = InternalServerErrorException; class NotImplementedException extends HttpException { constructor(error) { super(error, 501); } } exports.NotImplementedException = NotImplementedException; class BadGatewayException extends HttpException { constructor(error) { super(error, 502); } } exports.BadGatewayException = BadGatewayException; class ServiceUnavailableException extends HttpException { constructor(error) { super(error, 503); } } exports.ServiceUnavailableException = ServiceUnavailableException; class GatewayTimeoutException extends HttpException { constructor(error) { super(error, 504); } } exports.GatewayTimeoutException = GatewayTimeoutException; class ExpiredException extends HttpException { constructor(error) { super(error, 410); } } exports.ExpiredException = ExpiredException; //# sourceMappingURL=http.expection.js.map