fix(providers): preserve observations and primary cleanup failures

This commit is contained in:
morluto
2026-10-09 21:01:52 +08:00
parent 88640f60fe
commit 0696bde266
18 changed files with 629 additions and 232 deletions
+18 -5
View File
@@ -188,7 +188,18 @@ export class NativeDmgArtifactReader implements ArtifactReader {
throw new ArtifactReaderFailure(
"unavailable",
`DMG detach or mount-root cleanup failed for ${JSON.stringify(this.path)}: ${failureMessage(detachFailure)}`,
{ cause: detachFailure },
{
cause: detachFailure,
cleanup: {
reason: failureMessage(detachFailure),
resources: [
...this.#devices.map((device) => `DMG device ${device}`),
...(this.#mountRoot === undefined
? []
: [`DMG mount root ${this.#mountRoot}`]),
],
},
},
);
}
@@ -298,10 +309,12 @@ export class NativeDmgArtifactReader implements ArtifactReader {
cleanupFailure = cleanupCause;
}
if (cleanupFailure !== undefined)
throw new ArtifactReaderFailure(
"unavailable",
`DMG attach failed and cleanup could not detach every device: ${failureMessage(cause)}; cleanup: ${failureMessage(cleanupFailure)}`,
{ cause: new AggregateError([cause, cleanupFailure]) },
throw ArtifactReaderFailure.withCleanup(
cause,
ArtifactReaderFailure.cleanupObservation(
cleanupFailure,
`DMG mount root ${this.#mountRoot ?? this.path}`,
),
);
throw cause;
}