use thiserror::Error;
#[derive(Clone, Debug, Error)]
#[error("the requested host is unavailable")]
pub struct HostUnavailable;
#[derive(Clone, Debug, Error)]
#[error("A backend-specific error has occurred: {description}")]
pub struct BackendSpecificError {
pub description: String,
}
#[derive(Debug, Error)]
pub enum DevicesError {
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum DeviceNameError {
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum SupportedStreamConfigsError {
#[error("The requested device is no longer available. For example, it has been unplugged.")]
DeviceNotAvailable,
#[error(
"Invalid argument passed to the backend. For example, this happens when trying to read capture capabilities when the device does not support it."
)]
InvalidArgument,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum DefaultStreamConfigError {
#[error("The requested device is no longer available. For example, it has been unplugged.")]
DeviceNotAvailable,
#[error("The requested stream type is not supported by the device.")]
StreamTypeNotSupported,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum BuildStreamError {
#[error("The requested device is no longer available. For example, it has been unplugged.")]
DeviceNotAvailable,
#[error("The requested stream configuration is not supported by the device.")]
StreamConfigNotSupported,
#[error("The requested device does not support this capability (invalid argument)")]
InvalidArgument,
#[error("Adding a new stream ID would cause an overflow")]
StreamIdOverflow,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum PlayStreamError {
#[error("the device associated with the stream is no longer available")]
DeviceNotAvailable,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum PauseStreamError {
#[error("the device associated with the stream is no longer available")]
DeviceNotAvailable,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}
#[derive(Debug, Error)]
pub enum StreamError {
#[error("The requested device is no longer available. For example, it has been unplugged.")]
DeviceNotAvailable,
#[error("{err}")]
BackendSpecific {
#[from]
err: BackendSpecificError,
},
}