Add more context in error messages

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-05-18 00:14:34 +02:00
parent 27b75ba2fc
commit d034a6f0e2

View file

@ -178,10 +178,12 @@ pub fn ask_select_from_list(list: &[&str]) -> Result<String> {
/// 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)]