Skip to content

Lesson 10: useNotification() from web3uikit is not reverting with an error. #4713

Discussion options

You must be logged in to vote

@InsidTrifl runContractFunction provides onSuccess and onError functions and you can handle errors in onError and show users notifications.

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);
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alymurtazamemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants