export declare const IMAPSDKErrorCode: { readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED"; readonly COMMAND_FAILED: "COMMAND_FAILED"; readonly CONNECT_TIMEOUT: "CONNECT_TIMEOUT"; readonly CONNECTION_CLOSED: "CONNECTION_CLOSED"; readonly DISPOSED: "DISPOSED"; readonly GREETING_TIMEOUT: "GREETING_TIMEOUT"; readonly INTERNAL: "INTERNAL"; readonly INVALID_STATE: "INVALID_STATE"; readonly MISSING_EXTENSION: "MISSING_EXTENSION"; readonly NO_CONNECTION: "NO_CONNECTION"; readonly PARSER_ERROR: "PARSER_ERROR"; readonly PROTOCOL_ERROR: "PROTOCOL_ERROR"; readonly SOCKET_TIMEOUT: "SOCKET_TIMEOUT"; readonly THROTTLED: "THROTTLED"; readonly TLS_FAILED: "TLS_FAILED"; readonly UNKNOWN: "UNKNOWN"; readonly UPGRADE_TIMEOUT: "UPGRADE_TIMEOUT"; }; export type IMAPSDKErrorCode = (typeof IMAPSDKErrorCode)[keyof typeof IMAPSDKErrorCode]; export type IMAPSDKErrorOptions = { readonly cause?: unknown; readonly serverResponseCode?: string; readonly oauthError?: unknown; readonly responseStatus?: 'NO' | 'BAD'; readonly responseText?: string; readonly throttleReset?: number; readonly extension?: string; readonly parserPosition?: number; readonly parserInput?: string; }; export declare class IMAPSDKError extends Error { readonly name: string; readonly code: IMAPSDKErrorCode | `PARSER_${string}`; readonly serverResponseCode?: string; readonly oauthError?: unknown; readonly responseStatus?: 'NO' | 'BAD'; readonly responseText?: string; readonly throttleReset?: number; readonly extension?: string; readonly parserPosition?: number; readonly parserInput?: string; constructor(code: IMAPSDKErrorCode, message: string, options?: IMAPSDKErrorOptions); static connection(code: typeof IMAPSDKErrorCode.NO_CONNECTION | typeof IMAPSDKErrorCode.CONNECTION_CLOSED | typeof IMAPSDKErrorCode.CONNECT_TIMEOUT | typeof IMAPSDKErrorCode.GREETING_TIMEOUT | typeof IMAPSDKErrorCode.SOCKET_TIMEOUT | typeof IMAPSDKErrorCode.UPGRADE_TIMEOUT | typeof IMAPSDKErrorCode.TLS_FAILED, message: string): IMAPSDKError; static authentication(message: string, serverResponseCode?: string, oauthError?: unknown): IMAPSDKError; static protocol(message: string, responseStatus?: 'NO' | 'BAD', responseText?: string, serverResponseCode?: string): IMAPSDKError; static commandFailed(message: string, serverResponseCode?: string, responseText?: string): IMAPSDKError; static parser(message: string, position?: number, input?: string): IMAPSDKError; static throttled(message: string, throttleReset: number): IMAPSDKError; static missingExtension(message: string, extension: string): IMAPSDKError; static invalidState(message: string): IMAPSDKError; static disposed(resource: string): IMAPSDKError; static internal(message: string, cause?: unknown): IMAPSDKError; static isIMAPSDKError(error: unknown): error is IMAPSDKError; } export declare const wrapError: (error: unknown, code: IMAPSDKErrorCode, message?: string) => IMAPSDKError; export declare const catchAsIMAPError: (fn: () => Promise | T, code: IMAPSDKErrorCode, message?: string) => Promise; export type ConnectionErrorCode = typeof IMAPSDKErrorCode.NO_CONNECTION | typeof IMAPSDKErrorCode.CONNECTION_CLOSED | typeof IMAPSDKErrorCode.CONNECT_TIMEOUT | typeof IMAPSDKErrorCode.GREETING_TIMEOUT | typeof IMAPSDKErrorCode.SOCKET_TIMEOUT | typeof IMAPSDKErrorCode.UPGRADE_TIMEOUT | typeof IMAPSDKErrorCode.TLS_FAILED; export declare class ConnectionError extends IMAPSDKError { readonly name = "ConnectionError"; constructor(code: ConnectionErrorCode, message: string); } export declare class AuthenticationError extends IMAPSDKError { readonly name = "AuthenticationError"; constructor(message: string, serverResponseCode?: string, oauthError?: unknown); } export declare class ProtocolError extends IMAPSDKError { readonly name = "ProtocolError"; constructor(message: string, responseStatus?: 'NO' | 'BAD', responseText?: string, serverResponseCode?: string); } export declare class ParserError extends IMAPSDKError { readonly name = "ParserError"; readonly code: `PARSER_${string}`; constructor(code: string, message: string, position?: number, input?: string); get position(): number | undefined; get input(): string | undefined; } export declare class ThrottleError extends IMAPSDKError { readonly name = "ThrottleError"; constructor(message: string, throttleReset: number); } export declare class MissingExtensionError extends IMAPSDKError { readonly name = "MissingExtensionError"; constructor(message: string, extension: string); } export type IMAPError = IMAPSDKError; //# sourceMappingURL=errors.d.ts.map