Chapter 8: Exceptions, Events, and Logging

Writing contracts is the fundamental purpose of Solidity. However, writing a contract demands sound error and exception handling skills. Errors and exceptions are the norms in programming, and Solidity provides ample infrastructure for managing both. Writing robust contracts with proper error and exception management is one of the requirements for any functional smart contract. Events are another important construct in Solidity. For all the topics that we've discussed so far, we've seen a caller that invokes functions in contracts; however, we have not discussed any mechanism through which a contract notifies its caller and others about changes in its state and otherwise. This is where events come in. ...

Get Solidity Programming Essentials - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.