-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Cannot access Error object and sendTransaction.on(error) not firing #6300
Comments
Thank you for submitting this error, it seems odd that our error is not catching this. I'll take a look into this |
@luu-alex hi! could it be the error in the code itself? or is on.error definetely not catching anything? |
Hey there, sorry for the long response. The issue |
This comment was marked as off-topic.
This comment was marked as off-topic.
Ah I see what you, version 4 metamask errors are not returning properly with error and code like version 1 errors. This is definitely an issue. I'll take a look into this and update when I have a solution for this. Thank you for reporting this) |
@luu-alex hi! any updates? ) |
Hey there! Sorry was away this week, I have a PR created and should be good to go for next week. thank you for waiting. |
Hi there @meri-maki the PR has been merged and is now in the dev branch. web3@4.1.1-dev.622174c.0 as well it'll be part of next release. When catching the error, make sure to use If theres any other issues please let me know. |
Hi @luu-alex ! I updated to 4.1.0 and replaced
to
Here is what i get in console... ![]() innerError object is undefined, the code is always 100... |
can you install the dev branch? https://www.npmjs.com/package/web3-eth/v/4.1.1-dev.622174c.0 |
@luu-alex updated, still a no |
After updating to |
Expected behavior
While working on error handling I noticed that I'm catching transaction errors in this format:
With this error I cannot access error code and other useful staff..
Tried adding web3.eth.sendTransaction.on('error', (error) => {} as written in docs, and access the innerError object
(https://docs.web3js.org/guides/basics/sign_and_send_tx/promi_event)
Tested with transaction cancellation but the event is not firing, but it should, right?
Steps to reproduce the behavior
the logic above was mentioned in this issue (#6249)
and previous logic was handling errors correctly (returning Error object, not vt)
Environment
"web3": "^4.0.3",
"web3-eth": "^4.0.3"
The text was updated successfully, but these errors were encountered: