I want to show condition in require as a message on frontend to user as alert message like 'wait for 5 minutes or wait while transaction is being processed'. In console.log, I can see this message but for user convinience, how to show it on frontend in react ? bold text is the message

Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":-32603,"message":"execution reverted: Wait for 1 minutes","data":{"originalError":{"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000125761697420666f722031206d696e757465730000000000000000000000000000","message":"execution reverted: Wait for 1 minutes"}}}, method="estimateGas", transaction={"from":"0x037182435bF0A591fc48fa0E58De19961A31eE64","to":"0xB0E9E0B6962B37022378B1C8aA24486BD8283B0A","data":"0x449d46c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.5.0)

1 Answer 1


If you place the code inside the try catch block, you can simply warn users by taking the error message.

For example,

try {
////Your code here.
catch(error) {
//When the above code throws error, catch will catch the error.
alert(error.reason); //OR
alert(error.message); //Try both and see which one suits you.

When the code throws errors, in your case, wait 1 minute, the catch will take the error. Then you are warning them by using inside window.alert or alert.

I used window.alert for example here, in your real app, either you can use modals or something else.

Tell me if it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.