mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
fix(javascript): retain completed recovery hashes on cancellation
This commit is contained in:
1 parent
5940600a22
commit
d442ac752e
3 files changed
+67
-24
No files matched your search
@@ -4,6 +4,7 @@ import {
|
||||
ArtifactFileCleanupFailure,
|
||||
withArtifactRegularFile,
|
||||
} from "../../artifacts/ArtifactFileOperation.js";
|
||||
import { fileSnapshotPartialObservationSchema } from "../../domain/fileSnapshotObservation.js";
|
||||
import { ArtifactReaderFailure } from "../../artifacts/ArtifactReader.js";
|
||||
import { ArtifactResourceScope } from "../../artifacts/ArtifactResourceScope.js";
|
||||
import { OwnedDirectoryHandle } from "../../filesystem/OwnedDirectoryHandle.js";
|
||||
@@ -100,11 +101,17 @@ const scanRecoveryFile = async (
|
||||
},
|
||||
);
|
||||
} catch (cause: unknown) {
|
||||
if (
|
||||
cause instanceof ArtifactFileCleanupFailure ||
|
||||
cause instanceof ArtifactFileCancelled
|
||||
)
|
||||
throw cause;
|
||||
if (cause instanceof ArtifactFileCleanupFailure) throw cause;
|
||||
if (cause instanceof ArtifactFileCancelled)
|
||||
throw new AnalysisCancelledError(OPERATION, {
|
||||
cause: cause.fileCancellation.reason,
|
||||
partialObservation: fileSnapshotPartialObservationSchema.parse(
|
||||
Object.assign({}, cause.fileCancellation.outcome.value, {
|
||||
kind: "file-snapshot-hash",
|
||||
path,
|
||||
}),
|
||||
),
|
||||
});
|
||||
if (cause instanceof ArtifactReaderFailure && cause.reason === "cancelled")
|
||||
throw new AnalysisCancelledError(OPERATION, {
|
||||
cause: artifactFileCancellationCause(cause),
|
||||
@@ -182,8 +189,7 @@ const snapshotRecoveryInput = async (
|
||||
cause instanceof AnalysisCancelledError ||
|
||||
cause instanceof AnalysisAccessDeniedError ||
|
||||
cause instanceof AnalysisArtifactChangedError ||
|
||||
cause instanceof ArtifactFileCleanupFailure ||
|
||||
cause instanceof ArtifactFileCancelled
|
||||
cause instanceof ArtifactFileCleanupFailure
|
||||
)
|
||||
throw cause;
|
||||
// The operation-wide input allowance is a deterministic byte budget, not
|
||||
|
||||
Reference in new issue
Block a user