9 lines
321 B
TypeScript
9 lines
321 B
TypeScript
// Node reports a missing file as ENOENT and a missing process as ESRCH, where
|
|
// Deno threw `Deno.errors.NotFound` for both.
|
|
export function isNotFound(error: unknown): boolean {
|
|
if (!(error instanceof Error) || !("code" in error)) {
|
|
return false;
|
|
}
|
|
return error.code === "ENOENT" || error.code === "ESRCH";
|
|
}
|