Skip to main content

droidrun_adb/
error.rs

1/// Errors from ADB operations.
2#[derive(Debug, thiserror::Error)]
3pub enum AdbError {
4    #[error("ADB I/O error: {0}")]
5    Io(#[from] std::io::Error),
6
7    #[error("ADB server returned FAIL: {0}")]
8    ServerFailed(String),
9
10    #[error("ADB protocol error: {0}")]
11    Protocol(String),
12
13    #[error("No device connected")]
14    NoDevice,
15
16    #[error("Device not online (state: {0})")]
17    DeviceNotOnline(String),
18
19    #[error("Device not found: {0}")]
20    DeviceNotFound(String),
21
22    #[error("Shell command failed: {0}")]
23    ShellError(String),
24
25    #[error("Install failed: {0}")]
26    InstallFailed(String),
27
28    #[error("Uninstall failed: {0}")]
29    UninstallFailed(String),
30
31    #[error("Sync protocol error: {0}")]
32    SyncError(String),
33
34    #[error("Root not available: {0}")]
35    RootFailed(String),
36
37    #[error("UTF-8 decode error: {0}")]
38    Utf8(#[from] std::string::FromUtf8Error),
39
40    #[error("Parse error: {0}")]
41    Parse(String),
42
43    #[error("Connection refused — is ADB server running? (adb start-server)")]
44    ConnectionRefused,
45
46    #[error("Timeout: {0}")]
47    Timeout(String),
48}
49
50pub type Result<T> = std::result::Result<T, AdbError>;