Question · Blockchain and Web3 course · Module 4: ethers.js & viem

Error Handling

What is the best way to handle errors when interacting with the blockchain?

Answer options

  • Ignore errors, the blockchain always works
  • Use try/catch and check for specific errors (e.g. insufficient funds)
  • Restart the application on every error
  • Only use console.log

You can check the correct answer by solving this task in the CodeWorlds game.