1use std::{fmt, error};
7
8#[derive(Debug, Clone)]
9pub struct StorageError(pub String);
10
11impl fmt::Display for StorageError {
12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13 write!(f, "{}", self.0)
14 }
15}
16
17impl error::Error for StorageError {
18 fn description(&self) -> &str {
19 &self.0
20 }
21
22 fn cause(&self) -> Option<&error::Error> {
23 None
24 }
25}
26
27#[derive(Debug, Clone)]
28pub struct ParseError;
29
30impl fmt::Display for ParseError {
31 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
32 write!(f, "Error while parsing the server response")
33 }
34}
35
36impl error::Error for ParseError {
37 fn description(&self) -> &str {
38 "Error while parsing the server response"
39 }
40
41 fn cause(&self) -> Option<&error::Error> {
42 None
43 }
44}
45
46#[derive(Debug, Clone)]
47pub struct ConnectionError;
48
49impl fmt::Display for ConnectionError {
50 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
51 write!(f, "Could not connect to yocto server")
52 }
53}
54
55impl error::Error for ConnectionError {
56 fn description(&self) -> &'static str {
57 "Could not connect to yocto server"
58 }
59
60 fn cause(&self) -> Option<&error::Error> {
61 None
62 }
63}