From d034a6f0e2028ba6a9c8fb5f9caef0148187563e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 18 May 2019 00:14:34 +0200 Subject: [PATCH] Add more context in error messages Signed-off-by: Matthias Beyer --- lib/etc/libimaginteraction/src/ask.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/etc/libimaginteraction/src/ask.rs b/lib/etc/libimaginteraction/src/ask.rs index 56a411e1..ea112d7c 100644 --- a/lib/etc/libimaginteraction/src/ask.rs +++ b/lib/etc/libimaginteraction/src/ask.rs @@ -178,10 +178,12 @@ pub fn ask_select_from_list(list: &[&str]) -> Result { /// The `nl` parameter can be used to configure whether a newline character should be printed pub fn ask_question(question: &str, nl: bool, output: &mut Write) -> Result<()> { if nl { - writeln!(output, "[imag]: {}?", Yellow.paint(question)).map_err(Error::from) + writeln!(output, "[imag]: {}?", Yellow.paint(question)) } else { - write!(output, "[imag]: {}?", Yellow.paint(question)).map_err(Error::from) + write!(output, "[imag]: {}?", Yellow.paint(question)) } + .context("Failed to write question to output") + .map_err(Error::from) } #[cfg(test)]