Skip to content

Commit

Permalink
fix(wallet): propagate offer handler exceptions to the WebSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Oct 8, 2020
1 parent 0f0df62 commit 3965361
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/dapp-svelte-wallet/api/src/lib-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,9 @@ export async function makeWallet({
.catch(rejected);
} catch (e) {
console.error('Have error', e);
if (offer.actions) {
E(offer.actions).error(offer, e);
}
rejected(e);
throw e;
}
Expand Down
13 changes: 13 additions & 0 deletions packages/dapp-svelte-wallet/api/src/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ export function buildRootObject(_vatPowers) {
[meta.channelHandle],
);
},
error(offer, reason) {
httpSend(
{
type: 'walletOfferResult',
data: {
id: offer.id,
dappContext: offer.dappContext,
error: `${(reason && reason.stack) || reason}`,
},
},
[meta.channelHandle],
);
},
handled(offer) {
if (handled) {
return;
Expand Down

0 comments on commit 3965361

Please sign in to comment.