Errors: ApiError, CheckFailed, RecordError

An operation refusal with code, stage and effect; a failed check; a journal error.

since 0.3.0

Methods

EntrySignatureAvailable sinceAPI 3
ApiErrorApiError: details, code, __cause__0.3.0new codes
CheckFailedCheckFailed(ApiError, AssertionError)0.1.0-rc.1¹unchanged
RecordErrorRecordError(ValueError)0.3.0unchanged

¹ Base form; the 0.3.0 extensions are described in the card.

API 3 changes (0.5.0)

New API 3 codes: unawaited_operation, already_awaited, operation_timeout, halt_timeout, expression_call_forbidden, unsupported_async_command, call_incomplete.

Recommended

An expected refusal goes through refused; the cause stays in __cause__.

with t.refused("command_failed") as failure:
    t.evaluate("no_such_symbol")
t.check("cause kept", failure.error.__cause__ is not None)

Avoid

Catching and suppressing ApiError turns a refusal into a false PASS.

from stm32_gdbtest import ApiError
try:
    t.ret(1 << 40)
except ApiError:
    pass                      # a refusal becomes a false PASS

The fragments show refused or discouraged patterns, not a working recipe.

Fragments for a scenario body; firmware symbols are illustrative.

← Reset and GDB commandsAll groups