Merge pull request #3810 from ethcore/defaults-parse-fix
Tolerate errors in user_defaults
This commit is contained in:
commit
e6444cd106
@ -128,7 +128,13 @@ impl Default for UserDefaults {
|
|||||||
impl UserDefaults {
|
impl UserDefaults {
|
||||||
pub fn load<P>(path: P) -> Result<Self, String> where P: AsRef<Path> {
|
pub fn load<P>(path: P) -> Result<Self, String> where P: AsRef<Path> {
|
||||||
match File::open(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()),
|
_ => Ok(UserDefaults::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user