Put in order · Blockchain and Web3 course · Module 7: Contract Interaction
Sorting: Handling an error from a contract
Arrange the steps for handling a custom error from a contract:
Items to put in order
- Call the function inside a try-catch
- Catch the error in the catch block
- Use contract.interface.parseError(error.data) to decode it
- Check if error.data exists
You can check the correct answer by solving this task in the CodeWorlds game.