Error handling
・Assert 👉 to test for internal errors & to check constant value
Error of type Panic(uint256)
・Require👉to ensure valid conditions that cannot be detected until execution time.
This includes conditions on inputs or return values from calls to external contracts.
An Error(string)
Expressions and Control Structures - Solidity 0.8.13 documentation

An error will undo all changes made to the state during a transaction.
You can throw an error by calling require, revert or assert.
require is used to validate inputs and conditions before execution.revert is similar to require. See the code below for details. It has no condtionsassert is used to check for code that should never be false. Failing assertion probably means that there is a bug.