File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ pub enum Error {
77 InvalidAddress ( String ) ,
88 InvalidSharedSecret ( String ) ,
99 InvalidVin ( String ) ,
10+ InvalidNetwork ( String ) ,
1011 Secp256k1Error ( secp256k1:: Error ) ,
1112 OutOfRangeError ( secp256k1:: scalar:: OutOfRangeError ) ,
1213 IOError ( std:: io:: Error ) ,
@@ -20,6 +21,7 @@ impl fmt::Display for Error {
2021 Error :: InvalidAddress ( msg) => write ! ( f, "{}" , msg) ,
2122 Error :: InvalidSharedSecret ( msg) => write ! ( f, "{}" , msg) ,
2223 Error :: InvalidVin ( msg) => write ! ( f, "{}" , msg) ,
24+ Error :: InvalidNetwork ( msg) => write ! ( f, "Invalid network: {}" , msg) ,
2325 Error :: Secp256k1Error ( e) => e. fmt ( f) ,
2426 Error :: OutOfRangeError ( e) => e. fmt ( f) ,
2527 Error :: IOError ( e) => e. fmt ( f) ,
Original file line number Diff line number Diff line change @@ -54,12 +54,7 @@ impl TryFrom<&str> for Network {
5454 "bitcoin" | "main" => Self :: Mainnet , // We also take the core style argument
5555 "regtest" => Self :: Regtest ,
5656 "testnet" | "signet" | "test" => Self :: Testnet , // core arg
57- _ => {
58- return Err ( Error :: GenericError ( format ! (
59- "Unknown value for network: {}" ,
60- value
61- ) ) )
62- }
57+ _ => return Err ( Error :: InvalidNetwork ( value. to_string ( ) ) ) ,
6358 } ;
6459 Ok ( res)
6560 }
You can’t perform that action at this time.
0 commit comments