Errors¶
Every exception the client raises, and the codes and reasons they carry. Guide: Errors.
errors
¶
Exception hierarchy. Driver failures arrive as data (CommandResult.error) and become CommandError; server-level failures arrive as gRPC status codes and are mapped in client.py.
TapError
¶
Bases: Exception
Base class for everything this package raises deliberately.
scan_partial
¶
scan_partial: ScanResult | None
Detached partial observations when raised during a scan; otherwise None.
SettingsRestorationError
¶
Bases: TapError
One or more temporary settings could not be restored.
failures contains (setting_name, exception) pairs in cleanup order. When the
block or setup already failed, that original exception remains primary and this error
is attached as settings_restoration_error (with a traceback note on Python 3.11+,
or an error log on Python 3.10).
ServerError
¶
Bases: TapError
The host server rejected or failed a call (unknown connection or device, bad argument,
driver start failure, ...). code is the gRPC status code name; reason is the server's
structured FailureReason, FailureReason.UNSPECIFIED when the failure did not come
from the daemon.
CommandError
¶
Bases: TapError
A driver command's outcome was error. code is an ErrorCode; detail refines it
(e.g. NOT_FOUND/END_REACHED); TRANSPORT_LOST/INDETERMINATE carry the transmission state. A
NOT_FOUND from a selector also carries narrowing: which part of the selector ruled the
nodes out, which the message shows on the lines after the first.
AppDiedError
¶
Bases: TapError
A watched app crashed or stopped responding during a guard() block, or during a test
(the pytest plugin's end-of-test check). Each line names the device ([serial]). deaths are the deaths, oldest first; death
the first. failure is what the block raised, if anything: the CommandError that
carried the death, or the block's own failure. It is also the exception's __cause__.
WaitTimeoutError
¶
Bases: TapError
A condition did not hold within its timeout; the message names the device, the
condition and what was observed so a log line alone is diagnosable: reason and
match_count for the waits the device runs (visible, one, gone, the state waits,
App.await_visible, App.await_screen_stable), last_state for a state wait whose node
never reached the state, last_observation and polls for the ones the client polls.
reason
¶
reason
Why the device-side condition was still unmet at its last poll; None for client-polled waits.
last_state
¶
last_state
A state wait's node as the device read it at the end (reason STATE_NOT_REACHED);
None otherwise.
condition_parts
¶
condition_parts
With STATE_NOT_REACHED: each part of the condition on that same node, and whether it
held. Empty otherwise.
narrowing
¶
narrowing
With reason NO_MATCH from visible / one / a state wait: which part of
the selector ruled the nodes out, read after the deadline. None otherwise.
AppDataError
¶
ErrorCode
¶
Bases: Enum
Why a driver command failed (CommandError.code). UNKNOWN also stands for a code
this client version does not know.
FailureReason
¶
Bases: Enum
The server's structured reason for a failed call (ServerError.reason).
UNSPECIFIED means the failure did not come from the daemon (a transport failure, a proxy,
a cancelled call) or carried a reason this client version does not know.
UNSUPPORTED_API
¶
UNSUPPORTED_API
The device's API level is too low for the call (detail REQUIRES_API_<n>).
DEVICE_SETTING
¶
DEVICE_SETTING
A device setting did not read back as written (or could not be restored).
DEVICE_FILE
¶
DEVICE_FILE
A device file was not written or read as asked: it exists and this device handle did not create it, its directory is missing, it is not a regular file, or it did not read back.
WaitReason
¶
Bases: Enum
Why a device-side wait timed out (WaitTimeoutError.reason).
STATE_NOT_REACHED
¶
STATE_NOT_REACHED
A state wait (enabled, checked, text_equals, ...): the node was there but never
in that state (WaitTimeoutError.last_state is how it was at the end).
APP_NOT_VISIBLE
¶
APP_NOT_VISIBLE
App.await_visible / App.await_screen_stable: the package never owned the focused
window.
NO_PERMISSION_PROMPT
¶
NO_PERMISSION_PROMPT
await_permission_prompt: no runtime-permission dialog showed a known choice.