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