Check existing issues
Viem Version
2.24.1
Current Behavior
When
- you use a
PublicClient
- with the
webSocket transport
- and call
watchBlocks with the emitOnBegin option,
- and you do not have an Internet connection
The script crashes with an error logged to console
Expected Behavior
When
- you use a
PublicClient
- with the
webSocket transport
- and call
watchBlocks with the emitOnBegin option
- and you do not have an Internet connection
The onError handler is called
Steps To Reproduce
- Add something to keep the script alive (like a setInterval)
- Disable your Internet connection.
- Create a
PublicClient
- with the
webSocket transport,
- call
watchBlocks with the emitOnBegin option
- Observe that the script stops, with errors logged to stdout
Link to Minimal Reproducible Example
https://github.com/oskarlh/viem-bug
Anything else?
No response