UNPKG

@rafikidota/http-exceptions

Version:

My own http exceptions library with blackjacks and hookers

214 lines (199 loc) 6.49 kB
/** * Class representing a generic HTTP exception. * * @class * @extends Error */ declare class HttpException extends Error { /** * HTTP status code associated with the exception. * @type {number} */ status: number; /** * Creates an instance of HttpException. * * @param {string} [message=Something went wrong] - Descriptive message for the exception. * @param {number} [status=500] - HTTP status code. */ constructor(message?: string, status?: number); } /** * Class representing an exception for HTTP requests with a 400 Bad Request error. * * @class * @extends HttpException */ declare class BadRequestException extends HttpException { /** * Creates an instance of BadRequestException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 401 Unauthorized error. * * @class * @extends HttpException */ declare class UnauthorizedException extends HttpException { /** * Creates an instance of UnauthorizedException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests with a 402 Payment Required error. * * @class * @extends HttpException */ declare class PaymentRequiredException extends HttpException { /** * Creates an instance of PaymentRequiredException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests with a 403 Forbidden error. * * @class * @extends HttpException */ declare class ForbiddenException extends HttpException { /** * Creates an instance of ForbiddenException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 404 Not Found error. * * @class * @extends HttpException */ declare class NotFoundException extends HttpException { /** * Creates an instance of NotFoundException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests with a 405 Method Not Allowed error. * * @class * @extends HttpException */ declare class MethodNotAllowedException extends HttpException { /** * Creates an instance of MethodNotAllowedException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests with a 405 Unsupported Media Type error. * * @class * @extends HttpException */ declare class UnsupportedMediaTypeException extends HttpException { /** * Creates an instance of UnsupportedMediaTypeException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 500 Internal Server Error. * * @class * @extends HttpException */ declare class InternalServerErrorException extends HttpException { /** * Creates an instance of InternalServerErrorException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 501 Not Implemented Error. * * @class * @extends HttpException */ declare class NotImplementedException extends HttpException { /** * Creates an instance of NotImplementedException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 502 Bad Gateway Error. * * @class * @extends HttpException */ declare class BadGatewayException extends HttpException { /** * Creates an instance of BadGatewayException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 503 Service Unavailable Error. * * @class * @extends HttpException */ declare class ServiceUnavailableException extends HttpException { /** * Creates an instance of ServiceUnavailableException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } /** * Class representing an exception for HTTP requests resulting in a 504 Gateway Timeout Error. * * @class * @extends HttpException */ declare class GatewayTimeoutException extends HttpException { /** * Creates an instance of GatewayTimeoutException. * * @param {string} message - A descriptive message for the exception. */ constructor(message: string); } type HttpExceptionType = typeof HttpException; type BadRequestExceptionType = typeof BadRequestException; type UnauthorizedExceptionType = typeof UnauthorizedException; type PaymentRequiredExceptionType = typeof PaymentRequiredException; type ForbiddenExceptionType = typeof ForbiddenException; type NotFoundExceptionType = typeof NotFoundException; type MethodNotAllowedExceptionType = typeof MethodNotAllowedException; type UnsupportedMediaTypeExceptionType = typeof UnsupportedMediaTypeException; type InternalServerErrorExceptionType = typeof InternalServerErrorException; type NotImplementedExceptionExceptionType = typeof NotImplementedException; export { BadGatewayException, BadRequestException, type BadRequestExceptionType, ForbiddenException, type ForbiddenExceptionType, GatewayTimeoutException, HttpException, type HttpExceptionType, InternalServerErrorException, type InternalServerErrorExceptionType, MethodNotAllowedException, type MethodNotAllowedExceptionType, NotFoundException, type NotFoundExceptionType, NotImplementedException, type NotImplementedExceptionExceptionType, PaymentRequiredException, type PaymentRequiredExceptionType, ServiceUnavailableException, UnauthorizedException, type UnauthorizedExceptionType, UnsupportedMediaTypeException, type UnsupportedMediaTypeExceptionType };