Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
27b75ba2fc
commit
d034a6f0e2
1 changed files with 4 additions and 2 deletions
|
@ -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
|
/// 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<()> {
|
pub fn ask_question(question: &str, nl: bool, output: &mut Write) -> Result<()> {
|
||||||
if nl {
|
if nl {
|
||||||
writeln!(output, "[imag]: {}?", Yellow.paint(question)).map_err(Error::from)
|
writeln!(output, "[imag]: {}?", Yellow.paint(question))
|
||||||
} else {
|
} 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)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in a new issue