fix(input)!: classify unresolvable source paths (#7847)

This commit is contained in:
morluto authored and GitHub committed 2026-10-29 01:52:34 +08:00
1 parent e79ad6ca8e
commit 5bef2b48b6
12 files changed
+175 -7

No files matched your search

+15 -1
View File
@@ -87,6 +87,7 @@ export const rootFilesystemFailure = (
| {
readonly code: "invalid-root" | "io";
readonly message: string;
readonly remediationAction?: string;
}
| undefined => {
if (!(cause instanceof Error)) return undefined;
@@ -94,8 +95,21 @@ export const rootFilesystemFailure = (
if (typeof code !== "string" || !FILESYSTEM_ERROR_CODES.has(code))
return undefined;
return {
code: code === "ENOENT" || code === "ENOTDIR" ? "invalid-root" : "io",
code: ["ENOENT", "ENOTDIR", "ELOOP", "ENAMETOOLONG"].includes(code)
? "invalid-root"
: "io",
message: `${operation}: ${cause.message}`,
...(code === "ELOOP"
? {
remediationAction:
"Repair the symbolic-link chain or select another reference source directory.",
}
: code === "ENAMETOOLONG"
? {
remediationAction:
"Select a reference source path within the operating system's path-length limits.",
}
: {}),
};
};