import { TFunction } from 'i18next';
export type GeneralErrorCodes = "DATA_VALIDATION_ERROR" | "NETWORK_ERROR" | "CANCELED_ERROR" | "INTERNAL_ERROR" | "UNKNOWN_ERROR";
export declare class ApplicationException<CodeT> extends Error {
    code: CodeT;
    serverMessage: string | null;
    constructor(message: string, code: CodeT, serverMessage: string | null);
}
export interface ErrorEntry<CodeT> {
    code: CodeT;
    condition?: (error: unknown) => boolean;
    getMessage: (t: TFunction, error: unknown) => string;
}
export interface ErrorHandlerOptions<CodeT extends string> {
    entries: ErrorEntry<CodeT>[];
    t?: TFunction;
    onRethrowError?: (error: unknown, exception: ApplicationException<CodeT | GeneralErrorCodes>) => void;
}
export declare class ErrorHandler<CodeT extends string> {
    entries: ErrorEntry<CodeT | GeneralErrorCodes>[];
    private t;
    private onRethrowError?;
    constructor({ entries, t, onRethrowError }: ErrorHandlerOptions<CodeT>);
    private matchesEntry;
    setTranslateFunction(t: TFunction): void;
    rethrowError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes>;
    getError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes> | null;
    getErrorCode(error: unknown): CodeT | GeneralErrorCodes | null;
    static getErrorMessage(error: unknown, fallbackToUnknown?: boolean): string | null;
}
export declare const SharedErrorHandler: ErrorHandler<never>;
