UNPKG

@alba-cars/common-modules

Version:

A package containing DTOs, validation classes and common modules and interfaces for Alba Cars

24 lines (23 loc) 989 B
export declare enum ErrorType { VALIDATION_ERROR = "VALIDATION_ERROR", NOT_FOUND = "NOT_FOUND", UNAUTHORIZED = "UNAUTHORIZED", FORBIDDEN = "FORBIDDEN", INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR", BAD_REQUEST = "BAD_REQUEST", AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR", AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR" } export declare class AppError extends Error { message: string; statusCode: number; type: ErrorType; details?: any; constructor(message: string, statusCode: number, type: ErrorType, details?: any); static badRequest(message: string, details?: any): AppError; static notFound(message: string, details?: any): AppError; static unauthorized(message: string, details?: any): AppError; static forbidden(message: string, details?: any): AppError; static internal(message: string, details?: any): AppError; static validationError(message: string, details?: any): AppError; }