/** * @file Error type-guard predicates — `isError` (with the `isErrorBuiltin` / * `isErrorShim` building blocks) and the libuv errno-code narrower * `isErrnoException`. Both are cross-realm-safe (they use `[[ErrorData]]` * slot semantics rather than `instanceof Error`). */ /** * Reference to the native ES2025 `Error.isError` when the running engine ships * it, otherwise `undefined`. Consumes the single primordial snapshot * ({@link ErrorIsError}) rather than re-probing the global — one capture point. * Exposed separately so tests and callers can detect the fast-path. */ export declare const isErrorBuiltin: ((value: unknown) => value is Error) | undefined; /** * Narrow a caught value to a Node.js `ErrnoException` — an Error with a `.code` * string set by libuv/syscall failures (e.g. `'ENOENT'`, `'EACCES'`, `'EBUSY'`, * `'EPERM'`). Cross-realm safe (builds on {@link isError}), and checks that * `code` is a string so a merely branded Error without a real errno code * returns `false`. * * @example * try { * await fsPromises.readFile(path) * } catch (e) { * if (isErrnoException(e) && e.code === 'ENOENT') { * // … retry, or return default … * } else { * throw e * } * } */ export declare function isErrnoException(value: unknown): value is NodeJS.ErrnoException; /** * `Error.isError` fallback shim — the in-language approximation used when the * native ES2025 method isn't available. * * Exported separately so test suites on engines that ship the native method can * still exercise the shim branch directly. Consumers should prefer * {@link isError}, which picks the native method when present. */ export declare function isErrorShim(value: unknown): value is Error; /** * Prefer the native ES2025 `Error.isError` when available (exact * `[[ErrorData]]` slot check, cross-realm-safe); fall back to * {@link isErrorShim} otherwise. */ export declare const isError: (value: unknown) => value is Error;