From 99f89dcd7d8b5f86aa8ac459b53a173e0dab0fd7 Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Thu, 19 Sep 2024 17:38:33 -0400 Subject: [PATCH] refactor: prefer seat.exit() to seat.fail() - discussion: https://github.com/Agoric/agoric-sdk/pull/9902#discussion_r1767377401 --- .../src/examples/staking-combinations.flows.js | 6 ++++-- .../test/examples/staking-combinations.test.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/src/examples/staking-combinations.flows.js b/packages/orchestration/src/examples/staking-combinations.flows.js index c7ab71afc32..37712097096 100644 --- a/packages/orchestration/src/examples/staking-combinations.flows.js +++ b/packages/orchestration/src/examples/staking-combinations.flows.js @@ -8,7 +8,7 @@ */ import { mustMatch } from '@endo/patterns'; -import { makeError } from '@endo/errors'; +import { makeError, q } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; import { ChainAddressShape } from '../typeGuards.js'; @@ -77,7 +77,9 @@ export const depositAndDelegate = async ( await contractState.localAccount.transfer(give.Stake, address); } catch (cause) { await zoeTools.withdrawToSeat(contractState.localAccount, seat, give); - throw seat.fail(makeError('ibc transfer failed', undefined, { cause })); + const errMsg = makeError(`ibc transfer failed ${q(cause)}`); + seat.exit(errMsg); + throw errMsg; } seat.exit(); await account.delegate(validator, give.Stake); diff --git a/packages/orchestration/test/examples/staking-combinations.test.ts b/packages/orchestration/test/examples/staking-combinations.test.ts index 7a9c61ac010..830f11a4042 100644 --- a/packages/orchestration/test/examples/staking-combinations.test.ts +++ b/packages/orchestration/test/examples/staking-combinations.test.ts @@ -229,7 +229,8 @@ test('start', async t => { }, ); await t.throwsAsync(vt.when(E(seat).getOfferResult()), { - message: 'ibc transfer failed', + message: + 'ibc transfer failed "[Error: simulated unexpected MsgTransfer packet timeout]"', }); await vt.when(E(seat).hasExited()); const payouts = await E(seat).getPayouts();