Sitemap

Solidity — All About Runtime Errors

10 min readApr 9, 2023
Press enter or click to view image in full size
photo by Sigmund on Unsplash

This article is Part II of the “All About Errors” sub-series.

After looking at Compile Time errors in Part I (errors generated by the Solidity compiler), we will now look in Part II at runtime errors (errors generated at the time you interact with a contract deployed on a live network).

As we will see, 4 main types of errors can be generated in Solidity: Error(string), Panic(uint256), custom error and invalid. We will cover the rules and semantics of each of them in this article. Finally, we will have a quick glance at some potential predictions for the new error types that might be added to the Solidity programming language.

Table of content
- Common examples of errors in Solidity
- Types of Solidity errors
- Error(string)
- Panic(uint256)
- Panic Error - Example
- Panic(uint256) error codes
- Custom Errors
- How to define custom errors?
- Why using custom errors over string errors?
- Named parameters for custom errors
- Natspec comments for custom errors
- Custom Errors are part of the ABI
- Invalid
- Future Type of Errors in Solidity

Common examples of errors in Solidity

Many scenarios exist where a runtime error could occur among the Solidity code of a contract.

--

--

Jean Cvllr
Jean Cvllr

Written by Jean Cvllr

Smart Contract engineer at @LUKSO. Full Stack Developer. https://github.com/CJ42

No responses yet