import type { PluginDefinition, Request } from '../types';
/**
 * catch error options
 */
export type CatchErrorOptions = {
    /**
     * when error in response.body
     * throw error to handler with `Promise.reject(error)`
     * @deprecated axios use interceptors.response.use to change response type would cause an error, use `serializerResponse` instead.
     */
    serializerData?: <T = any, R = T>(data: T) => R | Promise<R>;
    /**
     * when error in response.body, example: {code: 0, message: 'error message'}
     * throw error to handler with `Promise.reject(error)`
     * @param response
     * @returns
     */
    serializerResponse?: <T = any, R = T>(response: T) => R | Promise<R>;
    /**
     * error catch handler
     */
    handler?: (error: any) => Promise<any>;
};
/**
 * regist catch error plugin on current promise request
 * @param request request promise
 * @param options catch error options
 */
export declare function registCatchError(request: Request, options?: CatchErrorOptions): Request;
/**
 * 注册异常处理插件
 * 只在regist apis上运行 (and 自定义条件下)
 * @param options 插件配置
 */
export declare const createCatchErrorPlugin: PluginDefinition<CatchErrorOptions>;
declare module '../types' {
    interface RequestCustomConfig {
        /**
         * enable catch error
         * or catch error by Promise.catch locally
         * @default false
         */
        catchError?: boolean;
    }
}
