22
33use std:: { error, fmt, io} ;
44
5- use bitcoin:: { hex, secp256k1 } ;
5+ use bitcoin:: hex;
66
77/// The error type for errors produced in this library.
88#[ derive( Debug ) ]
@@ -12,9 +12,7 @@ pub enum Error {
1212 HexToBytes ( hex:: HexToBytesError ) ,
1313 Json ( serde_json:: error:: Error ) ,
1414 BitcoinSerialization ( bitcoin:: consensus:: encode:: FromHexError ) ,
15- Secp256k1 ( secp256k1:: Error ) ,
1615 Io ( io:: Error ) ,
17- InvalidAmount ( bitcoin:: amount:: ParseAmountError ) ,
1816 InvalidCookieFile ,
1917 /// The JSON result had an unexpected structure.
2018 UnexpectedStructure ,
@@ -46,18 +44,10 @@ impl From<bitcoin::consensus::encode::FromHexError> for Error {
4644 fn from ( e : bitcoin:: consensus:: encode:: FromHexError ) -> Error { Error :: BitcoinSerialization ( e) }
4745}
4846
49- impl From < secp256k1:: Error > for Error {
50- fn from ( e : secp256k1:: Error ) -> Error { Error :: Secp256k1 ( e) }
51- }
52-
5347impl From < io:: Error > for Error {
5448 fn from ( e : io:: Error ) -> Error { Error :: Io ( e) }
5549}
5650
57- impl From < bitcoin:: amount:: ParseAmountError > for Error {
58- fn from ( e : bitcoin:: amount:: ParseAmountError ) -> Error { Error :: InvalidAmount ( e) }
59- }
60-
6151impl fmt:: Display for Error {
6252 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
6353 use Error :: * ;
@@ -68,9 +58,7 @@ impl fmt::Display for Error {
6858 HexToBytes ( ref e) => write ! ( f, "hex to bytes decode error: {}" , e) ,
6959 Json ( ref e) => write ! ( f, "JSON error: {}" , e) ,
7060 BitcoinSerialization ( ref e) => write ! ( f, "Bitcoin serialization error: {}" , e) ,
71- Secp256k1 ( ref e) => write ! ( f, "secp256k1 error: {}" , e) ,
7261 Io ( ref e) => write ! ( f, "I/O error: {}" , e) ,
73- InvalidAmount ( ref e) => write ! ( f, "invalid amount: {}" , e) ,
7462 InvalidCookieFile => write ! ( f, "invalid cookie file" ) ,
7563 UnexpectedStructure => write ! ( f, "the JSON result had an unexpected structure" ) ,
7664 Returned ( ref s) => write ! ( f, "the daemon returned an error string: {}" , s) ,
@@ -90,9 +78,7 @@ impl error::Error for Error {
9078 HexToBytes ( ref e) => Some ( e) ,
9179 Json ( ref e) => Some ( e) ,
9280 BitcoinSerialization ( ref e) => Some ( e) ,
93- Secp256k1 ( ref e) => Some ( e) ,
9481 Io ( ref e) => Some ( e) ,
95- InvalidAmount ( ref e) => Some ( e) ,
9682 ServerVersion ( ref e) => Some ( e) ,
9783 InvalidCookieFile | UnexpectedStructure | Returned ( _) | MissingUserPassword => None ,
9884 }
0 commit comments