import { GFError, GFErrorOptions } from '../error/types'; import { GFResult } from '../result/types'; export type ObjectCatcher = (GFErrorOptions & { /** * Optional data to ainclude in the GFResult. * * @default undefined */ resultData?: TData; }) | GFError; export type ObjectCatcherWithoutData = Omit; export type ArrayCatcher = [data: TData, error?: ObjectCatcherWithoutData]; export type FunctionCatcher = ((e: any) => ArrayCatcher); export type GFCatcher = ArrayCatcher | FunctionCatcher | ObjectCatcher; export type GFTry = GFCatcher> = (tryer: () => TData, catchers: TCatcher, /** * Controls whether the error that is caught is automatically added as an inner to the provided error. * * @types true */ addInner?: boolean) => GFResult; export type GFTryAsync = GFCatcher> = (tryer: () => Promise, catchers: TCatcher, /** * Controls whether the error that is caught is automatically added as an inner to the provided error. * * @types true */ addInner?: boolean) => Promise>;