BudgetExceededException

class BudgetExceededException(val budgetType: BudgetExceededException.BudgetType, val context: ErrorContext, val used: Int, val limit: Int) : RuntimeException

Exception thrown when a complexity budget is exceeded during test generation.

This is a fail-fast mechanism to prevent combinatorial explosion and out-of-memory errors when processing OpenAPI specs with deeply nested oneOf/anyOf/allOf schemas.

Why This Is an Exception (Not Outcome.Failure)

This exception is intentionally an exception rather than an Outcome.Failure because:

  1. Immediate halt required: Budget violations represent hard limits that should stop processing immediately. There's no partial result that makes sense.

  2. Deep recursion context: Budget checks occur deep in recursive schema traversal (SchemaMerger, CombinationBudget). Propagating Outcome at each recursion level would be verbose and error-prone.

  3. Clear boundary: Exceptions bubble up naturally through the call stack and are caught at well-defined provider boundaries by runProviderSafely, which converts them to Outcome.Failure for consistent handling upstream.

Handling

Callers should not attempt to catch this exception directly. Instead:

  • Providers wrap their logic in runProviderSafely, which converts this to Outcome.Failure

  • The detailed message provides actionable guidance for increasing limits or simplifying schemas

See also

for the types of budgets that can be exceeded

Constructors

Link copied to clipboard
constructor(budgetType: BudgetExceededException.BudgetType, context: ErrorContext, used: Int, limit: Int)

Types

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
Link copied to clipboard
val limit: Int
Link copied to clipboard
Link copied to clipboard
open val message: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val used: Int