Skip to content

Commit d04691e

Browse files
shivamhwpclaude
andcommitted
fix(server): print the other-home refusal without a stack trace
The refusal is something the user fixes by rerunning with --base-dir, so the CLI now prints just its message, like other user errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 444d8b0 commit d04691e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎apps/server/src/cloud/bootService.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Effect from "effect/Effect";
77
import * as FileSystem from "effect/FileSystem";
88
import * as Layer from "effect/Layer";
99
import * as Path from "effect/Path";
10+
import { CliError } from "effect/cli";
1011
import { HttpClient } from "effect/http";
1112
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
1213

@@ -690,7 +691,10 @@ it.layer(NodeServices.layer)("boot service install", (it) => {
690691
const other = yield* makeService(undefined, "1.2.3", path.join(otherHome, ".t3"));
691692
commands.length = 0;
692693
expect(yield* other.restart).toBe("skipped");
693-
expect((yield* other.install().pipe(Effect.flip))._tag).toBe("BootServiceOtherBaseDirError");
694+
const refused = yield* other.install().pipe(Effect.flip);
695+
expect(refused._tag).toBe("BootServiceOtherBaseDirError");
696+
// The CLI prints a user message without a stack trace.
697+
expect(CliError.getUserMessage(refused)).toBe(refused.message);
694698
expect(yield* fs.readFileString(plan.unitPath)).toBe(unit);
695699
expect(commands).toEqual([]);
696700
expect((yield* other.status).otherBaseDir).toBe(baseDir);

‎apps/server/src/cloud/bootService.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as FileSystem from "effect/FileSystem";
99
import * as Layer from "effect/Layer";
1010
import * as Option from "effect/Option";
1111
import * as Path from "effect/Path";
12+
import { CliError } from "effect/cli";
1213
import { HttpClient } from "effect/http";
1314
import * as Schema from "effect/Schema";
1415

@@ -527,6 +528,11 @@ export class BootServiceOtherBaseDirError extends Schema.TaggedError<BootService
527528
override get message(): string {
528529
return `The T3 Code service on this machine serves ${this.installedBaseDir}, not ${this.baseDir}. Pass ${formatBootServiceBaseDirOption(this.installedBaseDir)} to manage it, or run \`t3 service uninstall ${formatBootServiceBaseDirOption(this.installedBaseDir)}\` first to move it; both data directories are kept.`;
529530
}
531+
532+
// A refusal the user fixes by rerunning, so the CLI prints the message, not a stack trace.
533+
override get [CliError.userMessage]() {
534+
return this.message;
535+
}
530536
}
531537

532538
export type BootServiceError =

0 commit comments

Comments
 (0)