Skip to content

Commit 6743217

Browse files
committed
fix(evm-wallet-experiment): update callVatExpectError to return error message directly
With the queueMessage RPC fix in @MetaMask/ocap-kernel, vat rejections now surface as response.error with the actual message rather than a generic 'Internal error'. Update callVatExpectError in both the docker e2e helper and the integration test runner to return response.error.message directly and throw on unexpected success, replacing the dead response.result.body path.
1 parent e67a37c commit 6743217

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

packages/evm-wallet-experiment/test/e2e/docker/helpers/daemon-client.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ async function callVat(socketPath, target, method, args = []) {
4646
async function callVatExpectError(socketPath, target, method, args = []) {
4747
const response = await rpc(socketPath, 'queueMessage', [target, method, args]);
4848
if (response.error) {
49-
return JSON.stringify(response.error);
49+
return response.error.message;
5050
}
5151
await waitUntilQuiescent();
52-
return response.result.body;
52+
throw new Error(`Expected error but call succeeded: ${JSON.stringify(response.result)}`);
5353
}
5454

5555
/**

packages/evm-wallet-experiment/test/integration/run-daemon-wallet.mjs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ async function callVat(socketPath, target, method, args = []) {
125125
}
126126

127127
/**
128-
* Send a queueMessage RPC expecting it to return an error CapData.
128+
* Send a queueMessage RPC expecting it to fail, and return the error message.
129+
* Throws if the call unexpectedly succeeds.
129130
*
130131
* @param {string} socketPath
131132
* @param {string} target
@@ -140,12 +141,12 @@ async function callVatExpectError(socketPath, target, method, args = []) {
140141
args,
141142
]);
142143
if (response.error) {
143-
// RPC-level error (method dispatch failed)
144-
return JSON.stringify(response.error);
144+
return response.error.message;
145145
}
146-
// Vat-level error (method threw, encoded as CapData)
147146
await waitUntilQuiescent();
148-
return response.result.body;
147+
throw new Error(
148+
`Expected error but call succeeded: ${JSON.stringify(response.result)}`,
149+
);
149150
}
150151

151152
// ---------------------------------------------------------------------------
@@ -315,10 +316,7 @@ async function main() {
315316
'signMessage',
316317
['should fail'],
317318
);
318-
assert(
319-
errorBody.includes('#error') || errorBody.includes('No authority'),
320-
'error surfaces through daemon',
321-
);
319+
assert(errorBody.includes('No authority'), 'error surfaces through daemon');
322320

323321
// -----------------------------------------------------------------------
324322
// Test 10: Terminate subcluster via daemon

0 commit comments

Comments
 (0)