Skip to content

Commit

Permalink
fix: error message
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaccoSordo committed Sep 2, 2024
1 parent 32dd0a1 commit 1a95c84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export class WalletConnectCommunicationClient extends CommunicationClient {

const { uri, approval } = await signClient.connect({ ...connectParams }).catch((error) => {
logger.error(`Init error: ${error.message}`)
localStorage && localStorage.setItem('beacon:wc-init-error', error.message)
localStorage && localStorage.setItem(StorageKey.WC_INIT_ERROR, error.message)
throw new Error(error.message)
})

Expand Down Expand Up @@ -1341,7 +1341,7 @@ export class WalletConnectCommunicationClient extends CommunicationClient {
this.subscribeToSessionEvents(this.signClient)
} catch (error: any) {
logger.error(error.message)
localStorage && localStorage.setItem('beacon:wc-init-error', error.message)
localStorage && localStorage.setItem(StorageKey.WC_INIT_ERROR, error.message)
return undefined
}
}
Expand Down
16 changes: 12 additions & 4 deletions packages/beacon-ui/src/ui/alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,20 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
}

const generateWCError = (title: string) => {
const errorMessage = localStorage ? localStorage.getItem('beacon:wc-init-error') : undefined
const errorMessage = localStorage ? localStorage.getItem(StorageKey.WC_INIT_ERROR) : undefined
const description: any = (
<>
<h3 style={{ color: '#FF4136', margin: '0.6px' }}>
A network error occurred. This issue is not caused by your wallet.
</h3>
<h3 style={{ color: '#FF4136', margin: '0.6px' }}>A network error occurred.</h3>
<h4>
This issue does not concern your wallet or dApp. If the problem persists, please report
it to Beacon{' '}
<span
style={{ 'text-decoration': 'underline', color: '#007bff', cursor: 'pointer' }}
onClick={() => setCurrentInfo('help')}
>
here
</span>
</h4>
{errorMessage && <span>{errorMessage}</span>}
</>
)
Expand Down

0 comments on commit 1a95c84

Please sign in to comment.