import { DatabaseErrorType, ErrorType, StatusCode } from '../../typings/enum-types'; export declare namespace Errors { /** * ErrorData * @desc Type representing error data */ type ErrorData = { /** * Error code */ readonly code: StatusCode; /** * Error description */ readonly description: string; }; /** * ErrorCode * @desc Type representing error codes */ const ErrorCode: Record; /** * ExtendableError * @desc Class representing extendable error */ class ExtendableError extends Error { readonly type: ErrorType; readonly message: string; /** * Error data by provided {@link ErrorType} */ readonly data: ErrorData; /** * Error timestamp */ readonly timestamp: number; /** * Extendable error constructor by input parameters * @param type initial input {@link ErrorType} * @param message initial input {@link string} message */ constructor(type: ErrorType, message: string); } /** * GeneralError * @desc Class representing general error */ class GeneralError extends ExtendableError { readonly type: ErrorType; readonly message: string; /** * Error arguments */ readonly args: any[]; /** * General error constructor by input parameters * @param type initial input {@link ErrorType} * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(type: ErrorType, message: string, ...args: any[]); /** * Updates current logging information * @protected */ protected logMessage(): void; } /** * TypeError * @desc Class representing type error */ class TypeError extends GeneralError { readonly message: string; /** * Type error constructor by input parameters * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(message: string, ...args: any[]); } /** * ValueError * @desc Class representing value error */ class ValueError extends GeneralError { readonly message: string; /** * Value error constructor by input parameters * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(message: string, ...args: any[]); } /** * ValidationError * @desc Class representing validation error */ class ValidationError extends GeneralError { readonly message: string; /** * Validation error constructor by input parameters * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(message: string, ...args: any[]); } /** * UnsupportedLanguageError * @desc Class representing unsupported language error */ class UnsupportedLanguageError extends GeneralError { readonly lang: string; /** * Unsupported language error constructor by input parameters * @param lang: initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(lang: string, ...args: any[]); } /** * RequestError * @desc Class representing request error */ class RequestError extends GeneralError { readonly message: string; /** * Request error constructor by input parameters * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(message: string, ...args: any[]); } /** * ResponseError * @desc Class representing request error */ class ResponseError extends GeneralError { readonly message: string; /** * Response error constructor by input parameters * @param message initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(message: string, ...args: any[]); } /** * UnsupportedParameterError * @desc Class representing unsupported parameter error */ class UnsupportedParameterError extends GeneralError { readonly parameter: string; /** * Unsupported parameter error constructor by input parameters * @param parameter: initial input {@link string} message * @param args initial input {@link Array} of arguments */ constructor(parameter: string, ...args: any[]); } /** * QueryParseError * @desc Class representing query parse error */ class QueryParseError extends GeneralError { readonly message: string; readonly start: string; readonly end: string; /** * Unsupported language error constructor by input parameters * @param message initial input {@link string} message * @param start initial input {@link number} start position * @param end initial input {@link number} end position * @param args initial input {@link Array} of arguments */ constructor(message: string, start: string, end: string, ...args: any[]); } /** * DbClientError * @desc Class representing database client errors */ class DbClientError extends GeneralError { readonly message: string; readonly code: DatabaseErrorType; readonly statusCode: number; constructor(message: string, code: DatabaseErrorType, ...args: any[]); static getStatusCodeFromCode(code: string): number; } const unprocessableEntityDbError: (message: string) => DbClientError; const notFoundDbError: (message: string) => DbClientError; const conflictDbError: (message: string) => DbClientError; /** * Error constructor types * @desc Types representing error constructors */ type ExtendableErrorConstructor = typeof ExtendableError; type GeneralErrorConstructor = typeof GeneralError; type TypeErrorConstructor = typeof TypeError; type ValidationErrorConstructor = typeof ValidationError; type UnsupportedLanguageErrorConstructor = typeof UnsupportedLanguageError; type RequestErrorConstructor = typeof RequestError; type ResponseErrorConstructor = typeof ResponseError; type UnsupportedParameterErrorConstructor = typeof UnsupportedParameterError; type QueryParseErrorConstructor = typeof QueryParseError; type DbClientErrorConstructor = typeof DbClientError; const newError: (code: StatusCode, description: string) => ErrorData; const typeError: (message: string, ...args: any[]) => TypeError; const valueError: (message: string, ...args: any[]) => ValueError; const validationError: (message: string, ...args: any[]) => ValidationError; const requestError: (param: string, ...args: any[]) => RequestError; const responseError: (param: string, ...args: any[]) => ResponseError; const unsupportedParamError: (param: string, ...args: any[]) => UnsupportedParameterError; const queryParseError: (message: string, start: string, end: string, ...args: any[]) => QueryParseError; const errSerializer: (err: Error) => Error; } //# sourceMappingURL=errors.d.ts.map