UNPKG

tar

Version:
27 lines • 1.13 kB
/** Data that a warning or an error of this package carries. */ export type WarnData = { file?: string; code?: string; tarCode?: string; recoverable?: boolean; [k: string]: unknown; }; /** An error with the data of the warning that caused it. */ export type TarError = Error & WarnData; /** The options that `warn` reads. */ export type WarnOptions = { /** Throw each warning as an error. */ strict?: boolean; /** Called for each warning when `strict` is not set. */ onwarn?: (code: string, message: string, data: WarnData) => unknown; /** The archive file. Each warning has it as `data.file`. */ file?: string; }; /** Make the error for a problem that is not recoverable. */ export declare const tarError: (opt: WarnOptions, code: string, message: string | Error, data?: WarnData) => TarError; /** * Report a problem. Call `opt.onwarn(code, message, data)`, or throw * the error if `opt.strict` is set or `data.recoverable` is false. */ export declare const warn: (opt: WarnOptions, code: string, message: string | Error, data?: WarnData) => void; //# sourceMappingURL=warn.d.ts.map