Expression that evaluates to the error to be thrown.
Typically an Error object construction with descriptive message explaining the business context of the failure. Should provide clear information about what business condition caused the error.
Should NOT involve API calls - use IApiOperateStatement for API operations that are expected to throw errors, and IErrorPredicate for testing expected API error conditions.
Example: new Error("Customer verification failed: invalid email format")
Type discriminator.
Explicit error throwing for test failure scenarios.
Used for custom error conditions or when specific business rule violations should cause immediate test termination with descriptive error messages.
IMPORTANT: For most validation scenarios, prefer predicate expressions:
IEqualPredicate
instead of manual equality checks with throwIConditionalPredicate
instead of condition checks with throwIErrorPredicate
for testing expected error conditionsOnly use IThrowStatement when:
E2E testing scenarios:
AI function calling usage: Use sparingly, primarily for business logic violations that require explicit error reporting and cannot be handled by the standard predicate validation system.