pub enum ApiError {
NetworkError(String),
ParseError(String),
SoapFault(u16),
InvalidParameter(String),
SubscriptionError(String),
DeviceError(String),
}Expand description
High-level API errors for Sonos operations
This enum provides domain-specific error types that abstract away the underlying SOAP communication details and provide meaningful error information for common failure scenarios when controlling Sonos devices.
Variants§
NetworkError(String)
Network communication error
This error occurs when there are network-level issues communicating with the device, such as connection timeouts, DNS resolution failures, or the device being unreachable.
ParseError(String)
Response parsing error
This error occurs when the device returns a valid response but the response content cannot be parsed into the expected format. This covers XML parsing errors, unexpected response formats, and event parsing issues.
SoapFault(u16)
SOAP fault returned by device
This error occurs when the device returns a SOAP fault response, indicating that the request was malformed or the operation failed.
InvalidParameter(String)
Invalid parameter value
This error is returned when an operation parameter has an invalid value. This covers volume out of range, invalid device states, malformed URLs, etc.
SubscriptionError(String)
Subscription operation failed
This error occurs when UPnP subscription operations (create, renew, unsubscribe) fail. This covers subscription failures, renewal failures, expired subscriptions, etc.
DeviceError(String)
Device operation error
This error covers device-specific issues like not being a group coordinator, unsupported operations, or invalid device states.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn subscription_expired() -> Self
pub fn subscription_expired() -> Self
Create a subscription expired error (used by subscription management)
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ValidationError> for ApiError
Convert from ValidationError to ApiError
impl From<ValidationError> for ApiError
Convert from ValidationError to ApiError