refactor(resources): move the selected-file target error projection into src/resources (#11489)

This commit is contained in:
morluto authored and GitHub committed 2026-11-16 08:58:40 +08:00
1 parent 9699ce9057
commit d3350d81fd
5 files changed
+5 -7

No files matched your search

@@ -0,0 +1,17 @@
import { BinaryTargetError } from "../domain/configurationErrors.js";
import { RejectedRegularFileSymlink } from "../filesystem/RegularFile.js";
import { regularFileSymlinkRecovery } from "./StableArtifactFailure.js";
/** Project a selected-file admission failure without reinterpreting its path. */
export const selectedFileTargetError = (
path: string,
primary: Error,
cause: unknown,
): BinaryTargetError =>
new BinaryTargetError(path, primary.message, {
cause,
...(primary instanceof RejectedRegularFileSymlink &&
primary.resolvedPath !== undefined
? { remediationAction: regularFileSymlinkRecovery(primary.resolvedPath) }
: {}),
});