Exceptions¶
exceptions
¶
Custom exceptions for Drone API.
Replaces silent failures (returning 0, [0,0,0], etc.) with proper exceptions.
DroneError
¶
Bases: Exception
Base exception for all drone API errors.
DroneConnectionError
¶
Bases: DroneError
Failed to connect to drone.
Raised when:
- Network connection to drone IP fails
- TCP/UDP socket creation fails
- Initial handshake times out
CommandTimeout
¶
Bases: DroneError
Command did not receive acknowledgment in time.
Raised when:
- No PLANE_ACK received within timeout
- Task processor wait_state times out
CommandRejected
¶
Bases: DroneError
Drone rejected the command.
Raised when:
- PLANE_ACK returns non-success result code
- Command validation fails on drone
NotReady
¶
Bases: DroneError
Drone is not in ready state for this operation.
Raised when:
- Attempting to fly without connection
- Attempting takeoff while already flying
- No heartbeat received from drone
LowBattery
¶
Bases: DroneError
Battery level too low for operation.
Raised when:
- Battery below threshold for requested operation
- Emergency low battery state detected
TelemetryUnavailable
¶
Bases: DroneError
Requested telemetry data not available.
Raised when:
- DataCenter has no flight_data for drone
- Telemetry update not received yet
- Specific sensor data missing
InvalidParameter
¶
Bases: DroneError
Invalid parameter value for command.
Raised when:
- Parameter out of valid range
- Invalid enum value
- Incompatible parameter combination
OperationInProgress
¶
Bases: DroneError
Another operation is already in progress.
Raised when:
- Attempting to start new command while previous running
- Task queue is full