Skip to content

Commit

Permalink
Handle provider selection cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Apr 2, 2024
1 parent 0c55d47 commit 39b02c0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ class Wallet {
if (defaultProvider) {
this.providerId = defaultProvider;
} else {
await this.selectProvider();
try {
await this.selectProvider();
} catch {
return {
status: 'error',
error: {
code: RpcErrorCode.INTERNAL_ERROR,
message:
'Failed to select the provider. User may have cancelled the selection prompt.',
},
};
}
}
}
const adapter = this.defaultAdapters[this.providerId as string];
Expand Down

0 comments on commit 39b02c0

Please sign in to comment.