Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Tolerate error is user_defaults (#4060)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw authored and gavofyork committed Jan 6, 2017
1 parent a7ed6f6 commit 178c3e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion parity/user_defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ impl Default for UserDefaults {
impl UserDefaults {
pub fn load<P>(path: P) -> Result<Self, String> where P: AsRef<Path> {
match File::open(path) {
Ok(file) => from_reader(file).map_err(|e| e.to_string()),
Ok(file) => match from_reader(file) {
Ok(defaults) => Ok(defaults),
Err(e) => {
warn!("Error loading user defaults file: {:?}", e);
Ok(UserDefaults::default())
},
},
_ => Ok(UserDefaults::default()),
}
}
Expand Down

0 comments on commit 178c3e1

Please sign in to comment.