Closed dohomi closed 2 years ago
Currently I am using following block to solve it, first I use .call
and that seems to be catched correctly. .send
does not seem to be able to show the error correctly :
try{
await contract.methods.mint(selectedAmount)
.call({ value: contractDescription.getCurrentCost })
await contract.methods.mint(selectedAmount)
.send({ value: contractDescription.getCurrentCost })
} catch(e){
console.log("error is thrown while trying to ming..", e)
}
This is how web3.js works. The send call is successfully sent, but you will need to wait until it is confirmed or rejected. Check the docs from web3.js on how to do this properly: https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#methods-mymethod-send
Will close this issue as it is related to web3.js, not react-moralis
New Feature Request
Checklist
Current Limitation
If an EVM error is being thrown if the user communicates with a contract through MetaMask then inside of NextJS the error is not being captured.
Is there any way to have a proper async error handling in place?
Feature / Enhancement Description
Add possibility to watch for errors of web3.ether.contract. The Transaction error is correct but I could not find a way how to handle the error.