blob: 7cf4603af4e75cf0b607a85fdfde9290aa0bc077 [file] [edit]
// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Checks whether an error is a Node.js filesystem "not found" or "not a directory" error
* (`ENOENT` or `ENOTDIR`).
*/
export function isNotFoundError(error: unknown): boolean {
const code = (error as NodeJS.ErrnoException | undefined)?.code;
return code === 'ENOENT' || code === 'ENOTDIR';
}