Skip to content

Commit

Permalink
Ignore the MetaMask error with code 1013 (#653)
Browse files Browse the repository at this point in the history
* Ignore the MetaMask error with code 1013

The error 1013 shouldn't lead to wallet disconnect, because it's just an attempting to reestablish the connection

* Use console.error instead of console.log

* Updated link to Metamask release and log message

* Fix code style
  • Loading branch information
shoom3301 authored Jan 13, 2023
1 parent 0b206a8 commit aeb9203
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/metamask/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export class MetaMask extends Connector {
})

this.provider.on('disconnect', (error: ProviderRpcError): void => {
// 1013 indicates that MetaMask is attempting to reestablish the connection
// https://github.com/MetaMask/providers/releases/tag/v8.0.0
if (error.code === 1013) {
console.debug('MetaMask logged connection error 1013: "Try again later"')
return
}
this.actions.resetState()
this.onError?.(error)
})
Expand Down

0 comments on commit aeb9203

Please sign in to comment.