diff --git a/packages/ethers/src/client.ts b/packages/ethers/src/client.ts index 8329b2760d..c72429ff57 100644 --- a/packages/ethers/src/client.ts +++ b/packages/ethers/src/client.ts @@ -66,6 +66,12 @@ export interface Web3ModalClientOptions extends Omit } +type CoinbaseProviderError = { + code: number + message: string + data: string | undefined +} + export type Web3ModalOptions = Omit declare global { @@ -281,6 +287,7 @@ export class Web3Modal extends Web3ModalScaffold { this.setCoinbaseProvider(ethersConfig) } catch (error) { EthersStoreUtil.setError(error) + throw new Error((error as CoinbaseProviderError).message) } } else if (id === ConstantsUtil.AUTH_CONNECTOR_ID) { this.setAuthProvider() diff --git a/packages/ethers5/src/client.ts b/packages/ethers5/src/client.ts index 610f212378..944e4c50d0 100644 --- a/packages/ethers5/src/client.ts +++ b/packages/ethers5/src/client.ts @@ -43,6 +43,12 @@ export interface Web3ModalClientOptions extends Omit } +type CoinbaseProviderError = { + code: number + message: string + data: string | undefined +} + export type Web3ModalOptions = Omit declare global { @@ -256,6 +262,7 @@ export class Web3Modal extends Web3ModalScaffold { await CoinbaseProvider.request({ method: 'eth_requestAccounts' }) } catch (error) { EthersStoreUtil.setError(error) + throw new Error((error as CoinbaseProviderError).message) } } },