File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -790,17 +790,16 @@ impl Config {
790
790
Ok ( toml:: from_str ( & text) ?)
791
791
}
792
792
793
- pub fn load ( ) -> Self {
793
+ pub fn load ( ) -> anyhow :: Result < Self > {
794
794
let home_path = Self :: system_config_path ( ) ;
795
795
let home = if home_path. exists ( ) {
796
796
Self :: load_from_file ( & home_path)
797
- . inspect_err ( |e| eprintln ! ( "config file {home_path:?} is invalid: {e:#?}" ) )
798
- . unwrap_or_default ( )
797
+ . inspect_err ( |e| eprintln ! ( "config file {home_path:?} is invalid: {e:#?}" ) ) ?
799
798
} else {
800
799
RawConfig :: new_with_localhost ( )
801
800
} ;
802
801
803
- Self { home }
802
+ Ok ( Self { home } )
804
803
}
805
804
806
805
#[ doc( hidden) ]
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ async fn main() -> Result<(), anyhow::Error> {
13
13
let matches = get_command ( ) . get_matches ( ) ;
14
14
let ( cmd, subcommand_args) = matches. subcommand ( ) . unwrap ( ) ;
15
15
16
- let config = Config :: load ( ) ;
16
+ let config = Config :: load ( ) ? ;
17
17
// Save a default version to disk
18
18
config. save ( ) ;
19
19
You can’t perform that action at this time.
0 commit comments