Files
rea/src/artifacts/SafeOutputTreeCreationFailure.ts
T
morluto 5d1a47768a feat(artifacts): surface the named integrity check in public artifact errors (#11052)
* feat(artifacts): surface the named integrity check in public artifact errors

ArtifactOperationError now carries integrityCheck from the reader failure
and projects it as details.integrity_check, including with artifact
integrity details. Rebuild sites copied a different subset of reader facts
each (ProcessCli.artifactFailureFacts, withCleanup, desktop, file-operation
cleanup, resource export, DMG inventory, safe output tree); they now spread
ArtifactReaderFailure.primaryFacts(), so a new reader fact has one owner.
ArtifactIntegrityCheck moves to the domain beside ArtifactAdmissionLimit.

* test(artifacts): check rebuilt cleanup failures keep the named integrity check
2026-11-15 19:53:05 +08:00

34 lines
1.1 KiB
TypeScript

import { ArtifactReaderFailure } from "./ArtifactReader.js";
import type { SafeOutputTree } from "./SafeOutputTree.js";
/** Setup failed after this tree was acquired; callers still own this exact tree. */
export class SafeOutputTreeCreationFailure extends ArtifactReaderFailure {
readonly tree: SafeOutputTree;
constructor(cause: unknown, tree: SafeOutputTree) {
const primary =
cause instanceof ArtifactReaderFailure
? cause
: new ArtifactReaderFailure("io", errorMessage(cause), { cause });
super(
primary.reason,
primary.message,
{
cause: primary,
...primary.primaryFacts(),
cancellation: primary.cancellation,
...(primary.cleanup === undefined ? {} : { cleanup: primary.cleanup }),
...(primary.partialObservation === undefined
? {}
: { partialObservation: primary.partialObservation }),
},
primary.details,
);
this.name = "SafeOutputTreeCreationFailure";
this.tree = tree;
}
}
const errorMessage = (cause: unknown): string =>
cause instanceof Error ? cause.message : String(cause);