AutoBE
    Preparing search index...

    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:

    • Use IEqualPredicate instead of manual equality checks with throw
    • Use IConditionalPredicate instead of condition checks with throw
    • Use IErrorPredicate for testing expected error conditions

    Only use IThrowStatement when:

    • Custom error handling logic that can't be expressed as predicates
    • Complex business rule violations requiring custom error messages
    • Exceptional cases where predicate expressions are insufficient

    E2E testing scenarios:

    • Custom validation failures with specific business context
    • Unexpected state conditions that should halt test execution
    • Complex error conditions requiring detailed diagnostic information

    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.

    interface IThrowStatement {
        expression: IExpression;
        type: "throwStatement";
    }
    Index

    Properties

    Properties

    expression: IExpression

    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: "throwStatement"

    Type discriminator.