1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum OpenRGBError {
6 #[error("Failed opening connection to OpenRGB server at {addr:?}")]
8 ConnectionError {
9 addr: String,
11
12 #[source]
14 source: std::io::Error,
15 },
16
17 #[error("Failed exchanging data with OpenRGB server")]
19 CommunicationError {
20
21 #[source]
23 #[from]
24 source: std::io::Error,
25 },
26
27 #[error("Invalid data encountered while communicating with OpenRGB server: {0}")]
29 ProtocolError(String),
30
31 #[error("{operation:?} is only supported since protocol version {min_protocol_version:?}, but version {current_protocol_version:?} is in use. Try upgrading the OpenRGB server.")]
33 UnsupportedOperation {
34
35 operation: String,
37
38 current_protocol_version: u32,
40
41 min_protocol_version: u32,
43 },
44}