UNPKG

dinoloop-es8

Version:

A lightweight REST API Library for building scalable Node.js server-side applications powered by Typescript

96 lines (95 loc) 3.33 kB
import { CustomException } from '../../exception'; import { HttpStatusCode } from '../../constants'; import { ActionParamExceptionCode } from '../parse_handlers'; /** * Passing Invalid values for arguments invokes this exception */ export declare class InvalidArgumentException extends CustomException { argumentValue: any; constructor(argumentValue: any, msg?: string); } /** * Registering null/undefined as routing values invokes this exception */ export declare class InvalidRouteException extends CustomException { httpVerb: string; action: string; controller: string; route: string | RegExp; constructor(route: string | RegExp, httpVerb: string, action: string, controller: string, msg?: string); } /** * When the requested route is not found in the route-table invokes this exception */ export declare class RouteNotFoundException extends CustomException { httpVerb: string; requestUrl: string; constructor(httpVerb: string, requestUrl: string, msg?: string); } /** * Passing Invalid values for action parameter invokes this exception */ export declare class ActionParamException extends CustomException { value: any; key: string; action: string; controller: string; exceptionCode: ActionParamExceptionCode; constructor(value: any, key: string, action: string, controller: string, exceptionCode: ActionParamExceptionCode, msg?: string); } /** * Creates HttpResponseException with the specified status code and value */ export declare class HttpResponseException<T> extends CustomException { statusCode: HttpStatusCode; content: T; constructor(statusCode: HttpStatusCode, content?: T); } /** * Creates HttpResponseException with HttpStatusCode.badRequest (400) */ export declare class BadRequestException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.unauthorized (401) */ export declare class UnauthorizedException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.forbidden (403) */ export declare class ForbiddenException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.notFound (404) */ export declare class NotFoundException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.internalServerError (500) */ export declare class InternalServerErrorException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.notImplemented (501) */ export declare class NotImplementedException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.badGateway (502) */ export declare class BadGatewayException<T> extends HttpResponseException<T> { constructor(content?: T); } /** * Creates HttpResponseException with HttpStatusCode.serviceUnavailable (503) */ export declare class ServiceUnavailableException<T> extends HttpResponseException<T> { constructor(content?: T); }