Lesson 10: useNotification() from web3uikit is not reverting with an error. #4713
-
I am working on the Nextjs Raffle Front End and when I pressed the enter raffle button, it gives me this object |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@InsidTrifl here is an example; await enterRaffle({
onSuccess: (tx) => {console.log(tx);},
onError:(error) => console.log(error);
}); In addition to that, it also provides a value which if you mark it true will throw an error and you can catch it using try-catch. here is an example; try {
await enterRaffle({
throwOnError: true,
onSuccess: (tx) => {console.log(tx);}
});
} catch(e) {
console.log(e);
} |
Beta Was this translation helpful? Give feedback.
@InsidTrifl
runContractFunction
provides onSuccess and onError functions and you can handle errors in onError and show users notifications.here is an example;
In addition to that, it also provides a value which if you mark it true will throw an error and you can catch it using try-catch.
here is an example;