The MetaMask extension has this feature to warn about transaction errors before a transaction is being made:

ALERT: Transaction Error. Exception thrown in contract code.

How is this done? A dry run of some sorts? Can I get this info about an upcoming transaction error in my JavaScript code too - before triggering a transaction to be signed by MetaMask? I am using react, drizzle, truffle and solidity.

And a follow-up question: unfortunately MetaMask doesn't show the contents of errors thrown by require() statements in solidity smart contracts. When I trigger the same error in truffle console however, I do see those contents. Is there a way to get this in the frontend?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.