mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 19:57:58 +00:00
refactor(resources): share artifact cancellation error projection (#14572)
This commit is contained in:
1 parent
aed2bf8826
commit
c27a0468e3
27 files changed
+103
-200
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
artifactFileCancellationCause,
|
||||
artifactFileCancellationError,
|
||||
ArtifactFileCancelled,
|
||||
ArtifactFileCleanupFailure,
|
||||
withArtifactRegularFile,
|
||||
@@ -122,10 +122,7 @@ const scanRecoveryFile = async (
|
||||
},
|
||||
);
|
||||
if (cause instanceof ArtifactReaderFailure && cause.reason === "cancelled")
|
||||
throw cancelledBy(
|
||||
OPERATION,
|
||||
carriedReason(artifactFileCancellationCause(cause)),
|
||||
);
|
||||
throw artifactFileCancellationError(OPERATION, cause);
|
||||
if (
|
||||
cause instanceof Error &&
|
||||
"code" in cause &&
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
ArtifactResourceScope,
|
||||
AnalysisCleanupLease,
|
||||
ArtifactReaderFailure,
|
||||
artifactFileCancellationCause,
|
||||
artifactFileCancellationError,
|
||||
SafeOutputTree,
|
||||
SafeOutputTreeCreationFailure,
|
||||
} from "../../resources/index.js";
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
AnalysisCapabilityUnavailableError,
|
||||
AnalysisOutputError,
|
||||
cancelledBy,
|
||||
carriedReason,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import {
|
||||
javascriptRecoveryResultSchema,
|
||||
@@ -183,18 +182,14 @@ export class WakaruProvider implements JavaScriptRecoveryPort {
|
||||
primary instanceof ArtifactReaderFailure &&
|
||||
primary.reason === "cancelled" &&
|
||||
primary.cleanup === undefined
|
||||
? cancelledBy(
|
||||
OPERATION,
|
||||
carriedReason(artifactFileCancellationCause(primary)),
|
||||
{
|
||||
...(primary.partialObservation === undefined
|
||||
? {}
|
||||
: { partialObservation: primary.partialObservation }),
|
||||
...(reportFailure === undefined
|
||||
? {}
|
||||
: { capturedOutput: reportFailure.capturedOutput }),
|
||||
},
|
||||
)
|
||||
? artifactFileCancellationError(OPERATION, primary, {
|
||||
...(primary.partialObservation === undefined
|
||||
? {}
|
||||
: { partialObservation: primary.partialObservation }),
|
||||
...(reportFailure === undefined
|
||||
? {}
|
||||
: { capturedOutput: reportFailure.capturedOutput }),
|
||||
})
|
||||
: primary;
|
||||
const residuals: string[] = [];
|
||||
const cleanupFailures: { resource: string; reason: string }[] = [];
|
||||
|
||||
Reference in new issue
Block a user