swayipc_types/error/
mod.rs1mod command_outcome;
2mod command_type;
3mod event;
4
5use thiserror::Error as ThisError;
6
7pub type Fallible<T> = Result<T, Error>;
8
9#[non_exhaustive]
10#[derive(Debug, ThisError)]
11pub enum Error {
12 #[error(transparent)]
13 Io(#[from] std::io::Error),
14 #[error(transparent)]
15 SerdeJson(#[from] serde_json::Error),
16 #[error("unexpected magic string, expected 'i3-ipc' but got '{}'", String::from_utf8_lossy(.0))]
17 InvalidMagic([u8; 6]),
18 #[error("did receive a reply with type '{0}' but send command with type '{1}'")]
19 InvalidCommandType(u32, u32),
20 #[error("received unimplemented event '{}' with type '{}'", String::from_utf8_lossy(.1), .0)]
21 UnimplementedEvent(u32, Vec<u8>),
22 #[error("failed to subscribe to events {0}")]
23 SubscriptionFailed(String),
24 #[error("command failed with '{0}'")]
25 CommandFailed(String),
26 #[error("command could not be parsed '{0}'")]
27 CommandParse(String),
28 #[error("could not find the socket for neither i3 nor sway")]
29 SocketNotFound,
30}