Skip to content

Commit 4cfe358

Browse files
refactor(rpc): map launch errors by their typed tags
1 parent c80aae2 commit 4cfe358

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

‎apps/server/src/ws.ts‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,18 +1481,29 @@ const makeWsRpcLayer = (
14811481
...result,
14821482
projection: projectThreadProjectionForWire(result.projection),
14831483
})),
1484-
Effect.mapError(
1485-
(cause) =>
1484+
Effect.catchTags({
1485+
AttachmentClaimError: (cause) =>
14861486
new OrchestrationV2ThreadLaunchError({
14871487
commandId: input.commandId,
14881488
projectId: input.projectId,
1489-
message:
1490-
cause._tag === "AttachmentClaimError"
1491-
? cause.message
1492-
: "Failed to launch thread",
1489+
message: cause.message,
14931490
cause,
14941491
}),
1495-
),
1492+
ThreadLaunchError: (cause) =>
1493+
new OrchestrationV2ThreadLaunchError({
1494+
commandId: input.commandId,
1495+
projectId: input.projectId,
1496+
message: "Failed to launch thread",
1497+
cause,
1498+
}),
1499+
ServerRuntimeStartupError: (cause) =>
1500+
new OrchestrationV2ThreadLaunchError({
1501+
commandId: input.commandId,
1502+
projectId: input.projectId,
1503+
message: "Failed to launch thread",
1504+
cause,
1505+
}),
1506+
}),
14961507
),
14971508
{
14981509
"rpc.aggregate": "orchestration",

0 commit comments

Comments
 (0)