mirror of
https://github.com/taigrr/adb.git
synced 2026-04-14 08:18:23 -07:00
- Implement filterErr to detect device-not-found, offline, unauthorized, connection-refused, and multiple-device errors from stderr output - Add ErrDeviceNotFound, ErrDeviceOffline, ErrDeviceUnauthorized, ErrConnectionRefused, ErrMoreThanOneDevice sentinel errors - Remove log.Printf in CaptureSequence (was marked TODO for removal) - Fix ConnString to use local variable instead of mutating value receiver - Update go directive to 1.26.2 - Update README: check implemented features, fix intro typo, add root/keyevent/getevent to supported functions list - Expand filterErr tests for all new error patterns
33 lines
1.9 KiB
Go
33 lines
1.9 KiB
Go
package adb
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
// ErrStdoutEmpty is returned when an execution should have data but has none.
|
|
ErrStdoutEmpty = errors.New("stdout expected to contain data but was empty")
|
|
// ErrNotInstalled is returned when adb cannot be found in PATH.
|
|
ErrNotInstalled = errors.New("adb is not installed or not in PATH")
|
|
// ErrCoordinatesNotFound is returned when touch event coordinates are missing.
|
|
ErrCoordinatesNotFound = errors.New("coordinates for an input event are missing")
|
|
// ErrConnUSB is returned when connect/disconnect is called on a USB device.
|
|
ErrConnUSB = errors.New("cannot call connect/disconnect to device using USB")
|
|
// ErrResolutionParseFail is returned when screen resolution output cannot be parsed.
|
|
ErrResolutionParseFail = errors.New("failed to parse screen size from input text")
|
|
// ErrDestExists is returned when a pull destination file already exists.
|
|
ErrDestExists = errors.New("destination file already exists")
|
|
// ErrDeviceNotFound is returned when no device is connected or the target device cannot be found.
|
|
ErrDeviceNotFound = errors.New("device not found")
|
|
// ErrDeviceOffline is returned when the target device is offline.
|
|
ErrDeviceOffline = errors.New("device offline")
|
|
// ErrDeviceUnauthorized is returned when the device has not authorized USB debugging.
|
|
ErrDeviceUnauthorized = errors.New("device unauthorized; check the confirmation dialog on the device")
|
|
// ErrConnectionRefused is returned when the connection to a device is refused.
|
|
ErrConnectionRefused = errors.New("connection refused")
|
|
// ErrMoreThanOneDevice is returned when multiple devices are connected and no serial is specified.
|
|
ErrMoreThanOneDevice = errors.New("more than one device/emulator; use -s to specify a device")
|
|
// ErrUnspecified is returned when the exact error cannot be determined.
|
|
ErrUnspecified = errors.New("an unknown error has occurred, please open an issue on GitHub")
|
|
)
|