import type { Multi, Ignore } from "./types"; /** * Ignores errors with the given code in sync functions. * * @param ignore is the code or codes to ignore. * @param fn is the function to execute and ignore some of the errors. * @returns `undefined`. * * @typeParam R is the return type of the executed function. * * @thorws if error is not one of the ignored codes. * * @example * import * as ignore from "ignor"; * ignore.code("ENOENT", () => readFileSync("file.txt")); * ignore.code(["ENOENT", "OTHER"], () => readFileSync("file.txt")); */ export declare function ignoreCode(ignore: Multi | undefined, fn: (...args: any[]) => R): undefined | R; /** * Ignores errors with the given code in sync functions. * * @param ignore is the code or codes to ignore. * @param defaultValue is the default value to return if an error is ignored. * @param fn is the function to execute and ignore some of the errors. * @returns `undefined`. * * @typeParam D is the type of returned default value if an error is ignored. * @typeParam R is the return type of the executed function. * * @thorws if error is not one of the ignored codes. * * @example * import * as ignore from "ignor"; * ignore.code("ENOENT", "default", () => readFileSync("file.txt")); * ignore.code(["ENOENT", "OTHER"], "default", () => readFileSync("file.txt")); */ export declare function ignoreCode(ignore: Multi | undefined, defaultValue: D, fn: (...args: any[]) => R): D | R; /** * Ignores errors with the given code in async functions. * * @param ignore is the code or codes to ignore. * @returns `undefined`. * * @thorws if error is not one of the ignored codes. * * @example * import * as ignore from "ignor"; * await got(url).catch(ignore.code("ECONNREFUSED")); * await got(url).catch(ignore.code(["ECONNREFUSED", "OTHER"])); */ export declare function ignoreCode(ignore?: Multi): (e: Error) => undefined; /** * Ignores errors with the given code in async functions. * * @param ignore is the code or codes to ignore. * @param defaultValue is the default value to return if an error is ignored. * @returns default value. * * @typeParam D is the type of returned default value if an error is ignored. * * @thorws if error is not one of the ignored codes. * * @example * import * as ignore from "ignor"; * await got(url).catch(ignore.code("ECONNREFUSED", [])); * await got(url).catch(ignore.code(["ECONNREFUSED", "OTHER"], [])); */ export declare function ignoreCode(ignore: Multi | undefined, defaultValue: D): (e: Error) => D; export declare function ignoreMessage(ignore: Multi | undefined, fn: (...args: any[]) => R): undefined | R; export declare function ignoreMessage(ignore: Multi | undefined, defaultValue: D, fn: (...args: any[]) => R): D | R; export declare function ignoreMessage(ignore?: Multi): (e: Error) => undefined; export declare function ignoreMessage(ignore: Multi | undefined, defaultValue: D): (e: Error) => D; export declare function ignoreStatus(ignore: Multi | undefined, fn: (...args: any[]) => R): undefined | R; export declare function ignoreStatus(ignore: Multi | undefined, defaultValue: D, fn: (...args: any[]) => R): D | R; export declare function ignoreStatus(ignore?: Multi): (e: Error) => undefined; export declare function ignoreStatus(ignore: Multi | undefined, defaultValue: D): (e: Error) => D; //# sourceMappingURL=ignore.d.ts.map