Use return value: fail if content could not be read
This commit is contained in:
parent
ff281e4334
commit
c380e0f64f
1 changed files with 5 additions and 1 deletions
6
src/ui/external/editor.rs
vendored
6
src/ui/external/editor.rs
vendored
|
@ -101,7 +101,11 @@ pub fn edit_content(rt: &Runtime, old_content: String) -> (String, bool) {
|
|||
|
||||
let mut contents = String::new();
|
||||
File::open(filepath).map(|mut file| {
|
||||
file.read_to_string(&mut contents);
|
||||
file.read_to_string(&mut contents).map_err(|e| {
|
||||
error!("Error reading content: {}", e);
|
||||
debug!("Error reading content: {:?}", e);
|
||||
exit(1);
|
||||
}).is_ok();
|
||||
(contents, true)
|
||||
}).unwrap_or((old_content, false))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue