1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use crate::role::Role;
/// Result type alias for xa11y operations.
pub type Result<T> = std::result::Result<T, Error>;
/// Structured error type for xa11y operations.
/// Designed to be informative across FFI boundaries.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Accessibility permissions not granted.
#[error("Permission denied: {instructions}")]
PermissionDenied { instructions: String },
/// The target application advertises an accessibility tree but its
/// content is empty because the app's accessibility bridge is disabled
/// (Chromium/Electron on Linux without `--force-renderer-accessibility`,
/// for example).
#[error("Accessibility not enabled for {app}: {instructions}")]
AccessibilityNotEnabled { app: String, instructions: String },
/// No element matched the selector.
#[error("No element matched selector: {selector}")]
SelectorNotMatched { selector: String },
/// The node's platform handle is stale and re-traversal could not relocate it.
#[error("Element stale: could not relocate element for selector: {selector}")]
ElementStale { selector: String },
/// The requested action is not supported by this element.
#[error("Action {action} not supported on {role}")]
ActionNotSupported { action: String, role: Role },
/// Text value input is not supported for this element on this platform.
#[error("Text value input not supported for this element")]
TextValueNotSupported,
/// A wait_for or wait_for_event call exceeded its timeout.
#[error("Timeout after {elapsed:?}")]
Timeout { elapsed: std::time::Duration },
/// The selector string could not be parsed.
#[error("Invalid selector '{selector}': {message}")]
InvalidSelector { selector: String, message: String },
/// Invalid argument to an action method.
#[error("Invalid action data: {message}")]
InvalidActionData { message: String },
/// The element has no bounds (e.g. an off-screen or virtual node), so a
/// screen point can't be computed for input simulation.
#[error("Element has no bounds")]
NoElementBounds,
/// The requested operation has no implementation on this platform/session
/// (e.g. pointer warp on Wayland without a portal grant).
#[error("Unsupported: {feature}")]
Unsupported { feature: String },
/// A platform-specific error occurred.
#[error("Platform error ({code}): {message}")]
Platform { code: i64, message: String },
}