1use thiserror::Error;
2
3#[derive(Error, Debug)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("I/O error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("Missing child stdout: {0}")]
13 MissingChildStdout(&'static str),
14
15 #[error("Missing child stdin: {0}")]
17 MissingChildStdin(&'static str),
18
19 #[cfg(any(feature = "chacha20", feature = "salsa20", feature = "aes_ctr"))]
21 #[error("Cipher error: {0}")]
22 Cipher(String),
23
24 #[error("Other error: {0}")]
26 Other(String),
27
28 #[cfg(feature = "wincode")]
30 #[error("Wincode read error: {0}")]
31 WincodeRead(#[from] wincode::ReadError),
32
33 #[cfg(feature = "wincode")]
35 #[error("Wincode write error: {0}")]
36 WincodeWrite(#[from] wincode::WriteError),
37
38 #[cfg(feature = "wincode")]
40 #[error("Wincode IO write error: {0}")]
41 WincodeIoWrite(#[from] wincode::io::WriteError),
42
43 #[error("UTF-8 decoding error: {0}")]
45 FromUtf8(#[from] std::string::FromUtf8Error),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;