Refactor recoverable Effect fallbacks to orElseSucceed (#2968)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-06-05 05:47:56 +00:00
1 parent a084fbbc0a
commit 9da430c828
42 files changed
+182 -318

No files matched your search

+11 -15
View File
@@ -178,13 +178,11 @@ const resolveGitCommitHash = Effect.fn("resolveGitCommitHash")(function* (repoRo
cwd: repoRoot,
}),
).pipe(
Effect.catch(() =>
Effect.succeed({
stdout: "",
stderr: "",
exitCode: 1,
}),
),
Effect.orElseSucceed(() => ({
stdout: "",
stderr: "",
exitCode: 1,
})),
);
if (result.exitCode !== 0) {
@@ -220,13 +218,11 @@ const resolvePythonForNodeGyp = Effect.fn("resolvePythonForNodeGyp")(function* (
const probe = yield* spawnAndCollectOutput(
ChildProcess.make("python", ["-c", "import sys;print(sys.executable)"]),
).pipe(
Effect.catch(() =>
Effect.succeed({
stdout: "",
stderr: "",
exitCode: 1,
}),
),
Effect.orElseSucceed(() => ({
stdout: "",
stderr: "",
exitCode: 1,
})),
);
if (probe.exitCode !== 0) {
@@ -1008,7 +1004,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
const copiedArtifacts: string[] = [];
for (const entry of stageEntries) {
const from = path.join(stageDistDir, entry);
const stat = yield* fs.stat(from).pipe(Effect.catch(() => Effect.succeed(null)));
const stat = yield* fs.stat(from).pipe(Effect.orElseSucceed(() => null));
if (!stat || stat.type !== "File") continue;
const to = path.join(options.outputDir, entry);
+1 -1
View File
@@ -73,7 +73,7 @@ const commandExists = Effect.fn("commandExists")(function* (command: string) {
return yield* spawner.spawn(lookupCommand).pipe(
Effect.flatMap((child) => child.exitCode),
Effect.map((exitCode) => exitCode === 0),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
});
-2
View File
@@ -7,7 +7,6 @@
"test": "vp test run"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.2.77",
"@effect/platform-node": "catalog:",
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
@@ -16,7 +15,6 @@
},
"devDependencies": {
"@effect/vitest": "catalog:",
"@types/bun": "catalog:",
"vite-plus": "catalog:"
}
}