Skip to content

How to catch WebsocketProvider errors ? #3669

Answered by 0xARK
0xARK asked this question in Q&A
Discussion options

You must be logged in to vote

@ricmoo Idk if I can move this to issue or not.

After furthermore research, I came to the following conclusions:

  • the above change seems to not break anything but is not good as it does not allow to reject correctly.
  • the promise allowing to send websocket subscription request is not catched anywhere.

If you want to fix that in your local npm packages, you need to change:


To:

    }).catch(e => _this.emit("subscribeError", e));

This allows you to catch error in the following way :

this.provider = new Ethers.providers.WebSocketProvider(rpc);
this.provider
    .on('pending', (txHash) => {

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by 0xARK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant