Skip to content

Commit 7e181b9

Browse files
sirtimidclaude
andcommitted
fix(evm-wallet-experiment): surface underlying twin errors in multi-twin wrapper
The `away-coordinator.transferNative` / `transferFungible` wrappers (introduced in PR #939 when the coordinator was split) wrap per-twin rejections as `throw new Error('All delegation twins failed', { cause: errors })`. The kernel's RPC error serialization only propagates `Error.message`, not `Error.cause`, so callers (including `run-delegation-twin-e2e.mjs`) only see the generic "All delegation twins failed" — which loses the actual reason (e.g. "Insufficient budget: requested 3, remaining 2"). Concatenate the cause messages into the wrapper's message text so the specific per-twin rejection reason survives to the caller. Keep the structured `cause` array intact for programmatic consumers. Unblocks the "enforces cumulativeSpend locally" assertion in the delegation-twin docker e2e test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cd4065c commit 7e181b9

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

packages/evm-wallet-experiment/src/vats/away-coordinator.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,14 @@ export function buildRootObject(
18111811
errors.push(error);
18121812
}
18131813
}
1814-
throw new Error('All delegation twins failed', { cause: errors });
1814+
throw new Error(
1815+
`All delegation twins failed: ${errors
1816+
.map((cause) =>
1817+
cause instanceof Error ? cause.message : String(cause),
1818+
)
1819+
.join('; ')}`,
1820+
{ cause: errors },
1821+
);
18151822
}
18161823
if (homeSection) {
18171824
return E(homeSection).transferNative(to, amt);
@@ -1852,7 +1859,14 @@ export function buildRootObject(
18521859
errors.push(error);
18531860
}
18541861
}
1855-
throw new Error('All delegation twins failed', { cause: errors });
1862+
throw new Error(
1863+
`All delegation twins failed: ${errors
1864+
.map((cause) =>
1865+
cause instanceof Error ? cause.message : String(cause),
1866+
)
1867+
.join('; ')}`,
1868+
{ cause: errors },
1869+
);
18561870
}
18571871
if (homeSection) {
18581872
return E(homeSection).transferFungible(token, to, amt);

0 commit comments

Comments
 (0)