Introduction

The main goal of Solidity is to create contracts. Writing a contract, however, necessitates sound error and exception handling. In programming, errors and exceptions are commonplace. Solidity offers a robust architecture for handling both. A good practice is to write solid contracts with good error and exception management.

Functions, Errors and Exceptions in Solidity.

Assert and Require

Convenience functions that check for conditions include assert and need. These throw exceptions when requirements are not satisfied. Before exceptions, need is used to check inputs and conditions. Code that should never be false is checked using the assert statement.

Transactions and Errors

Assert Vs Require

Assert is Triggered

Require is Triggered

Throw

Functions[Visibility, Constructor, Fallback]


Setter and Getter Functions

Function Visibility

Constructor

Fallback Function