Errors: ApiError, CheckFailed, RecordError
An operation refusal with code, stage and effect; a failed check; a journal error.
since 0.3.0
Methods
| Entry | Signature | Available since | API 3 |
|---|---|---|---|
ApiError | ApiError: details, code, __cause__ | 0.3.0 | new codes |
CheckFailed | CheckFailed(ApiError, AssertionError) | 0.1.0-rc.1¹ | unchanged |
RecordError | RecordError(ValueError) | 0.3.0 | unchanged |
¹ 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 PASSThe fragments show refused or discouraged patterns, not a working recipe.
Fragments for a scenario body; firmware symbols are illustrative.