crates/lint/docs/custom-errors.md
Severity: Gas
ID: custom-errors
Flags require(cond), require(cond, "message"), revert("message"), and revert() calls;
suggests replacing them with a revert CustomError(...).
Reports require calls with no reason or whose second argument is a string literal, and
revert(...) calls that are either bare or have a string-literal argument.
Custom errors:
Solidity 0.8.4+ supports custom errors natively.
require(amount > 0, "amount must be > 0");
require(amount > 0);
revert("not authorized");
revert();
error AmountZero();
error NotAuthorized();
if (amount == 0) revert AmountZero();
if (!authorized) revert NotAuthorized();
This is a Gas-severity lint and is not applied to test or script files.