import { HttpStatus } from '@nestjs/common'; import { NameValue } from './helpers/normal'; /** * 400 invalidParameter Indicates that a request parameter has an invalid value. * 400 badRequest * 401 invalidCredentials Indicates that the auth token is invalid or has expired. * 403 insufficientPermissions Indicates that the user does not have sufficient permissions for the entity specified in the query. * 409 conflict Indicates that the request message conflicts with the current state of the resource. * The API request cannot be completed because the requested operation would conflict with an existing item. * For example, a request that tries to create a duplicate item would create a conflict, * though duplicate items are typically identified with more specific errors. * 409 duplicate The requested operation failed because it tried to create a resource that already exists. * 422 unprocessable Indicates an issue with the request message considered in isolation. * 429 tooManyRequests * 500 unexpected Better not use it. */ export declare const AsunaErrorCode: { InvalidParameter: NameValue; BadRequest: NameValue; InvalidCredentials: NameValue; InsufficientPermissions: NameValue; InvalidCsrfToken: NameValue; InvalidToken: NameValue; NotFound: NameValue; Conflict: NameValue; Duplicate: NameValue; TooManyRequests: NameValue; Unprocessable: NameValue; /** * use specific errors instead */ Unexpected__do_not_use_it: NameValue; }; /** * 该异常构造前端可以进行交互的格式 */ export declare class AsunaBaseException extends Error { httpStatus: HttpStatus; code: string; name: string; message: string; localeMessage: string; errors?: any; constructor(httpStatus: HttpStatus, code: string, name: string, message: string, localeMessage: string, errors?: any); } export declare class AsunaException extends AsunaBaseException { constructor(nameValue: NameValue, message?: string, errors?: any); static of(nameValue: NameValue, code?: string, message?: string, localeMessage?: string, errors?: any): AsunaException; } export declare class ErrorException extends AsunaBaseException { constructor(name: string, message?: string, errors?: any); } export declare class ValidationException extends AsunaException { constructor(model: any, errors: any); } export declare enum AsunaExceptionTypes { ElementExists = "ElementExists", WrongPassword = "WrongPassword", AuthExpired = "AuthExpired", TenantNeeded = "TenantNeeded", Unpublished = "Unpublished", ResourceLimit = "ResourceLimit", InvalidAccount = "InvalidAccount", AccountExists = "AccountExists", BadRequest = "BadRequest", InvalidToken = "InvalidToken", FormatError = "FormatError", Upload = "Upload" } interface AsunaExceptionOpts { code: string; nameValue: NameValue; message: (...params: any[]) => string; localMessage: (...params: any[]) => string; } export declare class AsunaExceptionHelper { private static registers; static reg(type: string, opts: AsunaExceptionOpts): void; static genericException(type: T, params?: Parameters, errors?: any): AsunaException; } export {};