use thiserror::Error;
#[derive(Error, Debug)]
pub enum OpenRGBError {
#[error("Failed opening connection to OpenRGB server at {addr:?}")]
ConnectionError {
addr: String,
#[source]
source: std::io::Error,
},
#[error("Failed exchanging data with OpenRGB server")]
CommunicationError {
#[source]
#[from]
source: std::io::Error,
},
#[error("Invalid data encountered while communicating with OpenRGB server: {0}")]
ProtocolError(String),
#[error("{operation:?} is only supported since protocol version {min_protocol_version:?}, but version {current_protocol_version:?} is in use. Try upgrading the OpenRGB server.")]
UnsupportedOperation {
operation: String,
current_protocol_version: u32,
min_protocol_version: u32,
},
}