Delphi / Object Pascal · Exception

EArgumentException Exception

What does EArgumentException Exception mean in Delphi / Object Pascal?

Raised when a routine or method is called with an argument it can't make sense of - an out-of-domain value, the wrong combination of parameters, or a value that fails an internal validation check the method performs on its inputs.

EArgumentException ExceptionDelphi (VCL) · Delphi (FireMonkey)

Condition

Raised when a routine or method is called with an argument it can't make sense of - an out-of-domain value, the wrong combination of parameters, or a value that fails an internal validation check the method performs on its inputs.

Fix

When catching this, check the exact values passed to the failing call against that method's documented valid ranges or combinations; when raising it for custom validation, include the offending value and parameter name in the message.

Related exception