pub fn demand_system_error(
expected_error: SystemError,
result: TransactionResult,
)
Expand description
Asserts that a system error occurs, regardless of which instruction index produced it.
This is the “anywhere” version that matches system errors without caring about instruction index. When a transaction fails, there’s exactly one error - this function checks if that error matches the expected system error, ignoring which instruction caused it.
When to use: Use this when you know the error should occur but don’t care which instruction produced it. Perfect for single-instruction transactions or when testing general error conditions.
When not to use: When you need to verify the error occurs at a specific instruction index
to test precise error handling - use demand_system_error_at_index
instead.
§Arguments
expected_error
- The expected system errorresult
- The result of executing a transaction vialitesvm::LiteSVM::send_transaction