Open iprotoni opened 1 week ago
Duplicate of #2933. As mentioned in the discussion on #2933, we'll need a true reproduction of the issue. I wasn't able to repro with a test.
It's also possible it's not related to Web3.js, but rather the callback
function from a dependency. See discussion here.
Overview
Whenever an RPC request encounters an error, it results in an uncaught rejection. This means that even if the outer call is wrapped in a try-catch block, the error cannot be caught and handled properly.
Steps to reproduce
Description of bug
There is an issue in the packages/library-legacy/src/connection.ts file at line 1679. Whenever an RPC request encounters an error, it results in an uncaught rejection. This means that even if the outer call is wrapped in a try-catch block, the error cannot be caught and handled properly.
Expected Behavior:
The error should be caught and handled properly within the try-catch block surrounding the RPC request call.
Actual Behavior:
The error results in an uncaught rejection, bypassing the try-catch block.
Proposed Solution:
Add a try-catch block around the RPC request in packages/library-legacy/src/connection.ts at line 1679 to handle errors properly and prevent uncaught rejections.