@web3-react/injected-connector#NoEthereumProviderError JavaScript Examples

The following examples show how to use @web3-react/injected-connector#NoEthereumProviderError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: error.js    From semaphore_auth with MIT License 8 votes vote down vote up
function getErrorMessage (error) {
  if (error instanceof NoEthereumProviderError) {
    return 'No Ethereum browser extension detected, install MetaMask on desktop or visit from a dApp browser on mobile.'
  } else if (error instanceof UnsupportedChainIdError) {
    return `You're connected to an unsupported network. Please switch to ${supportedNetworkName}`
  } else if (error instanceof UserRejectedRequestErrorInjected) {
    return 'Please authorize this website to access your Ethereum account.'
  } else {
    console.error(error)
    return 'An unknown error occurred. Check the console for more details.'
  }
}
Example #2
Source File: WalletConnectionErrorHandler.js    From pure.finance with MIT License 6 votes vote down vote up
getErrorKey = function (error) {
  if (error instanceof NoEthereumProviderError) {
    return 'error-no-ethereum-provider'
  } else if (error instanceof UnsupportedChainIdError) {
    return 'error-unsupported-network'
  } else if (
    error instanceof UserRejectedRequestErrorInjected ||
    error instanceof UserRejectedRequestErrorWalletConnect
  ) {
    return 'error-rejected-wallet-connection'
  }
  console.error(error)
  return 'error-unknown'
}