1use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("io error: {0}")]
8 Io(#[from] std::io::Error),
9
10 #[error("failed to deserialize wire line: {source}; raw: {raw_line}")]
11 Deserialization {
12 source: serde_json::Error,
13 raw_line: String,
14 },
15
16 #[error("failed to serialize command: {0}")]
17 Serialization(#[from] serde_json::Error),
18
19 #[error("pi binary not found on PATH")]
20 BinaryNotFound,
21
22 #[error("pi exited before answering; stderr: {0}")]
23 ProcessExited(String),
24
25 #[error("command failed: {0}")]
26 CommandFailed(String),
27}
28
29pub type Result<T> = std::result::Result<T, Error>;