From c380e0f64fe03a3e68d243519add5972bd2552d3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 5 Jan 2016 16:05:59 +0100 Subject: [PATCH] Use return value: fail if content could not be read --- src/ui/external/editor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/external/editor.rs b/src/ui/external/editor.rs index fb43895c..ea2980aa 100644 --- a/src/ui/external/editor.rs +++ b/src/ui/external/editor.rs @@ -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)) }