1use std::path::PathBuf;
3
4#[cfg(any(feature = "network", feature = "network_blocking"))]
5use ciborium::Value;
6
7#[derive(thiserror::Error, Debug)]
8pub enum Error {
9 #[error("Error while building path: {0}")]
10 InvalidPath(String),
11
12 #[error("Invalid or malformed certificate: {0}")]
14 CertificateFailure(String),
15
16 #[error("{0}")]
17 Connection(String),
18
19 #[error("Got an empty payload")]
20 EmptyPayload,
21
22 #[error("Couldn't deserialize message:\n{0}")]
23 MessageDeserialization(String),
24
25 #[cfg(any(feature = "network", feature = "network_blocking"))]
26 #[error("Got unexpected but valid message. Are you up-to-date?:\n{0:#?}")]
27 UnexpectedPayload(Value),
28
29 #[error("Couldn't serialize message:\n{0}")]
30 MessageSerialization(String),
31
32 #[error("Requested message size of {0} with only {1} being allowed.")]
33 MessageTooBig(usize, usize),
34
35 #[error("Error while reading configuration:\n{0}")]
36 ConfigDeserialization(String),
37
38 #[error("Some error occurred. {0}")]
39 Generic(String),
40
41 #[error("I/O error while {0}:\n{1}")]
42 IoError(String, std::io::Error),
43
44 #[error("Unexpected I/O error:\n{0}")]
45 RawIoError(#[from] std::io::Error),
46
47 #[error("I/O error at path {0:?} while {1}:\n{2}")]
48 IoPathError(PathBuf, &'static str, std::io::Error),
49
50 #[error("Unable to detect the username for the current user.{0}")]
51 NoUsername(String),
52
53 #[error(
56 "There seems to be an active pueue daemon.\n\
57 If you're sure there isn't, please remove the \
58 socket inside the pueue_directory manually."
59 )]
60 UnixSocketExists,
61}