File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use std:: net:: SocketAddr ;
22use std:: path:: PathBuf ;
33
4- use anyhow:: Result ;
54use clap:: ArgMatches ;
6- use config:: { Config , File , FileFormat } ;
5+ use config:: { Config , ConfigError , File , FileFormat } ;
76use serde:: Deserialize ;
87use url:: Url ;
98
@@ -25,7 +24,7 @@ pub struct AppConfig {
2524}
2625
2726impl AppConfig {
28- pub ( crate ) fn new ( matches : & ArgMatches ) -> Result < Self > {
27+ pub ( crate ) fn new ( matches : & ArgMatches ) -> Result < Self , ConfigError > {
2928 let builder = Config :: builder ( )
3029 . set_default ( "bitcoind_rpchost" , "http://localhost:18443" ) ?
3130 . set_override_option (
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ async fn main() -> Result<()> {
1616 env_logger:: init ( ) ;
1717
1818 let matches = cli ( ) ;
19- let config = AppConfig :: new ( & matches) ?;
19+ let config = AppConfig :: new ( & matches) . with_context ( || "Failed to parse config" ) ?;
2020 let app = App :: new ( config) ?;
2121
2222 match matches. subcommand ( ) {
You can’t perform that action at this time.
0 commit comments