UNPKG

@ace-fetch/graphql

Version:

Fetch Provider.

33 lines (32 loc) 967 B
import type { PluginDefinition } from '../types'; /** * catch error options */ export type CatchErrorOptions = { /** * 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 extends (config: any) => any>(request: Request, options?: CatchErrorOptions): (config?: Parameters<Request>[0]) => ReturnType<Request>; /** * 注册异常处理插件 * 只在regist graphqls上运行 (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; } }