guard clause
A check at the top of a method that throws if an argument is bad.
A guard clause validates a precondition on entry and throws (for example ArgumentNullException.ThrowIfNull) before any work is done.
Examples
if (quantity <= 0) throw new ArgumentOutOfRangeException(nameof(quantity));at the top of a method refuses bad input before any work starts.
See also