2025-12-28 17:45:06 +01:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
|
pub enum ControlPointError {
|
|
|
|
|
// Utiliser par les DeviceItems dans leur conversion vers un media renderer
|
|
|
|
|
#[error("{0} is not a MediaRenderer")]
|
|
|
|
|
IsNotAMediaRender(String),
|
|
|
|
|
#[error("{0} is not a MediaServer")]
|
|
|
|
|
IsNotAMediaServer(String),
|
|
|
|
|
#[error("Cannot build MusicRendererBackend for {0}")]
|
|
|
|
|
MusicRendererBackendBuild(String),
|
|
|
|
|
#[error("{0}")]
|
|
|
|
|
ParsingError(String),
|
|
|
|
|
#[error("OpenHome Error: {0}")]
|
|
|
|
|
OpenHomeError(String),
|
|
|
|
|
#[error("OpenHome Product source list does not expose a Playlist entry")]
|
|
|
|
|
OpenHomeNoPlaylistEntry(),
|
|
|
|
|
#[error("MusicRendererBackend {0} exposes no OpenHome services")]
|
|
|
|
|
OpenHomeNotAValidDevice(String),
|
|
|
|
|
#[error("UpnpError Error: {0}")]
|
|
|
|
|
UpnpError(String),
|
|
|
|
|
#[error("MusicRenderer operation '{0}' is not supported by backend '{1}'")]
|
|
|
|
|
UpnpOperationNotSupported(String, String),
|
|
|
|
|
#[error("Missing {0} element in SOAP body")]
|
|
|
|
|
UpnpMissingReturnValue(String),
|
|
|
|
|
#[error("Invalid {0} value: {1}")]
|
2026-01-03 08:19:23 +01:00
|
|
|
UpnpBadReturnValue(String, String),
|
2025-12-28 17:45:06 +01:00
|
|
|
#[error("Soap Error: Upnp action call {0}")]
|
|
|
|
|
SoapAction(String),
|
|
|
|
|
#[error("{0} returned UPnP error {1}: {2} (HTTP status {3})")]
|
2026-01-03 08:19:23 +01:00
|
|
|
SoapUpnpParseError(String, u32, String, u32),
|
2025-12-28 17:45:06 +01:00
|
|
|
#[error("{0} failed with HTTP status {1} and body: {2}")]
|
|
|
|
|
SoapActionWrongBody(String, u32, String),
|
|
|
|
|
#[error("Soap Error: No envelop for action {0}")]
|
|
|
|
|
SoapNoEnvelop(String),
|
|
|
|
|
#[error("ArilycTcp Error: {0}")]
|
|
|
|
|
ArilycTcpError(String),
|
|
|
|
|
#[error("LinkPlay Error: {0}")]
|
|
|
|
|
LinkPlayError(String),
|
|
|
|
|
#[error("Chromecast Error: {0}")]
|
|
|
|
|
ChromecastError(String),
|
|
|
|
|
#[error("MediaServer Error: {0}")]
|
|
|
|
|
MediaServerError(String),
|
|
|
|
|
#[error("Queue Error: {0}")]
|
|
|
|
|
QueueError(String),
|
2025-12-30 16:50:26 +01:00
|
|
|
#[error("Invalid time format: {0}")]
|
|
|
|
|
InvalidTimeFormat(String),
|
2026-01-03 08:19:23 +01:00
|
|
|
#[error("Error on snapshot: {0}")]
|
|
|
|
|
SnapshotError(String),
|
|
|
|
|
#[error("Error on ControlPoint: {0}")]
|
|
|
|
|
ControlPoint(String),
|
2026-04-09 11:19:54 +02:00
|
|
|
#[error("Queue sync cancelled (superseded by a newer request)")]
|
|
|
|
|
SyncCancelled,
|
2025-12-28 17:45:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ControlPointError {
|
|
|
|
|
pub fn upnp_operation_not_supported(operation: &str, service: &str) -> Self {
|
2026-01-03 08:19:23 +01:00
|
|
|
ControlPointError::UpnpOperationNotSupported(operation.to_string(), service.to_string())
|
2025-12-28 17:45:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn upnp_missing_return_value(value: &str) -> Self {
|
|
|
|
|
ControlPointError::UpnpMissingReturnValue(value.to_string())
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-03 08:19:23 +01:00
|
|
|
pub fn upnp_bad_return_value(name: &str, value: &str) -> Self {
|
|
|
|
|
ControlPointError::UpnpBadReturnValue(name.to_string(), value.to_string())
|
2025-12-28 17:45:06 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-03 08:19:23 +01:00
|
|
|
pub fn arilyc_tcp_error(message: &str) -> Self {
|
2025-12-28 17:45:06 +01:00
|
|
|
ControlPointError::ArilycTcpError(message.to_string())
|
|
|
|
|
}
|
2026-01-03 08:19:23 +01:00
|
|
|
}
|