1#[derive(Debug)]
7pub enum RepositoryError {
8 InvalidFormat,
10 InvalidUri,
12 MissingUri,
14 InvalidType,
16 InvalidSignature,
18 Lossy(deb822_lossless::lossy::Error),
20 Lossless(deb822_lossless::lossless::Error),
22 Io(std::io::Error)
24}
25
26impl From<std::io::Error> for RepositoryError {
27 fn from(e: std::io::Error) -> Self {
28 Self::Io(e)
29 }
30}
31
32impl std::fmt::Display for RepositoryError {
33 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
34 match self {
35 Self::InvalidFormat => write!(f, "Invalid repository format"),
36 Self::InvalidUri => write!(f, "Invalid repository URI"),
37 Self::MissingUri => write!(f, "Missing repository URI"),
38 Self::InvalidType => write!(f, "Invalid repository type"),
39 Self::InvalidSignature => write!(f, "The field `Signed-By` is incorrect"),
40 Self::Lossy(e) => write!(f, "Lossy parser error: {}", e),
41 Self::Lossless(e) => write!(f, "Lossless parser error: {}", e),
42 Self::Io(e) => write!(f, "IO error: {}", e),
43 }
44 }
45}