Solhint

Solhint

Community Analyzer

Enforces the use of Custom Errors over Require and Revert statements SOLHINT-W1002

Anti-pattern
Minor

Enforces the use of Custom Errors over Require and Revert statements

Bad Practice

  1. Use of require statement
require(userBalance >= availableAmount, "Insufficient Balance");
  1. Use of plain revert statement
revert();
  1. Use of revert statement with message
revert("Insufficient Balance");

Recommended

  1. Use of Custom Errors
revert CustomErrorFunction();
  1. Use of Custom Errors with arguments
revert CustomErrorFunction({ msg: "Insufficient Balance" });

Learn more

custom-errors on Solhint's documentation.