@@ -90,6 +90,7 @@ pub type DecodeResult<A> = Result<A, DecodeError>;
9090#[ derive( Debug ) ]
9191pub enum DecodeError {
9292 Decoder ( cbor:: DecodeError ) ,
93+ SodiumoxideDecoder ( sodiumoxide:: crypto:: sign:: Error ) ,
9394 InvalidArrayLen ( usize ) ,
9495 LocalIdentityChanged ( IdentityKey ) ,
9596 InvalidType ( u8 , & ' static str ) ,
@@ -102,6 +103,7 @@ impl fmt::Display for DecodeError {
102103 fn fmt ( & self , f : & mut fmt:: Formatter ) -> Result < ( ) , fmt:: Error > {
103104 match * self {
104105 DecodeError :: Decoder ( ref e) => write ! ( f, "CBOR decoder error: {}" , e) ,
106+ DecodeError :: SodiumoxideDecoder ( ref e) => write ! ( f, "Sodiumoxide decoder error: {}" , e) ,
105107 DecodeError :: InvalidArrayLen ( n) => write ! ( f, "CBOR array length mismatch: {}" , n) ,
106108 DecodeError :: LocalIdentityChanged ( _) => write ! ( f, "Local identity changed" ) ,
107109 DecodeError :: InvalidType ( t, ref s) => write ! ( f, "Invalid type {}: {}" , t, s) ,
@@ -130,3 +132,9 @@ impl From<cbor::DecodeError> for DecodeError {
130132 DecodeError :: Decoder ( err)
131133 }
132134}
135+
136+ impl From < sodiumoxide:: crypto:: sign:: Error > for DecodeError {
137+ fn from ( err : sodiumoxide:: crypto:: sign:: Error ) -> DecodeError {
138+ DecodeError :: SodiumoxideDecoder ( err)
139+ }
140+ }
0 commit comments