Summary
In this chapter, we covered exception handling and events. These are important topics in Solidity, especially when writing any serious decentralized applications on the Ethereum platform. Exception handling in Solidity is implemented using three functions: assert
, require
, and revert
. Although they sound similar, they have different purposes, which were explained in this chapter with the help of examples. Events help us to write scalable applications. Instead of continuously polling the platform for data and wasting resources, it's better to write events and then wait for them to execute functions asynchronously. This was also covered in this chapter. You will be able to use the skills learned in this chapter to add exception handling to your smart contracts, taking care of results arising out of unexpected environmental issues. Smart contracts allow you to notify in an asynchronous manner using logs and events when such an untoward incident happens.
In the next chapter...