@@ -40,6 +40,22 @@ pub enum PublishError {
40
40
TransformFailed ( std:: io:: Error ) ,
41
41
}
42
42
43
+ impl std:: fmt:: Display for PublishError {
44
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
45
+ write ! ( f, "{:?}" , self )
46
+ }
47
+ }
48
+
49
+ impl std:: error:: Error for PublishError {
50
+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
51
+ match self {
52
+ Self :: SigningError ( err) => Some ( err) ,
53
+ Self :: TransformFailed ( err) => Some ( err) ,
54
+ _ => None ,
55
+ }
56
+ }
57
+ }
58
+
43
59
/// Error associated with subscribing to a topic.
44
60
#[ derive( Debug ) ]
45
61
pub enum SubscriptionError {
@@ -49,6 +65,21 @@ pub enum SubscriptionError {
49
65
NotAllowed ,
50
66
}
51
67
68
+ impl std:: fmt:: Display for SubscriptionError {
69
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
70
+ write ! ( f, "{:?}" , self )
71
+ }
72
+ }
73
+
74
+ impl std:: error:: Error for SubscriptionError {
75
+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
76
+ match self {
77
+ Self :: PublishError ( err) => Some ( err) ,
78
+ _ => None ,
79
+ }
80
+ }
81
+ }
82
+
52
83
impl From < SigningError > for PublishError {
53
84
fn from ( error : SigningError ) -> Self {
54
85
PublishError :: SigningError ( error)
@@ -95,6 +126,14 @@ pub enum ValidationError {
95
126
TransformFailed ,
96
127
}
97
128
129
+ impl std:: fmt:: Display for ValidationError {
130
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
131
+ write ! ( f, "{:?}" , self )
132
+ }
133
+ }
134
+
135
+ impl std:: error:: Error for ValidationError { }
136
+
98
137
impl From < std:: io:: Error > for GossipsubHandlerError {
99
138
fn from ( error : std:: io:: Error ) -> GossipsubHandlerError {
100
139
GossipsubHandlerError :: Io ( error)
0 commit comments