Make filetest errors report full context (#2207)

* clif-util: do not convert `anyhow::Error`s into strings into `anyhow::Error`s

* filetests: Use the debug formatting of `anyhow::Error`s

This provides the full error context, not just the source error's message.
This commit is contained in:
Nick Fitzgerald
2020-09-18 11:33:38 -07:00
committed by GitHub
parent 7bfc4597a0
commit 010e5b9aa8
2 changed files with 3 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ impl Display for QueueEntry {
let p = self.path.to_string_lossy(); let p = self.path.to_string_lossy();
match self.state { match self.state {
State::Done(Ok(dur)) => write!(f, "{}.{:03} {}", dur.as_secs(), dur.subsec_millis(), p), State::Done(Ok(dur)) => write!(f, "{}.{:03} {}", dur.as_secs(), dur.subsec_millis(), p),
State::Done(Err(ref e)) => write!(f, "FAIL {}: {}", p, e), State::Done(Err(ref e)) => write!(f, "FAIL {}: {:?}", p, e),
_ => write!(f, "{}", p), _ => write!(f, "{}", p),
} }
} }

View File

@@ -161,8 +161,7 @@ fn main() -> anyhow::Result<()> {
.iter() .iter()
.map(|f| f.display().to_string()) .map(|f| f.display().to_string())
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
) )?;
.map_err(|s| anyhow::anyhow!("{}", s))?;
} }
Commands::Pass(p) => { Commands::Pass(p) => {
handle_debug_flag(p.debug); handle_debug_flag(p.debug);
@@ -172,8 +171,7 @@ fn main() -> anyhow::Result<()> {
&p.passes, &p.passes,
&p.target, &p.target,
&p.file.display().to_string(), &p.file.display().to_string(),
) )?;
.map_err(|s| anyhow::anyhow!("{}", s))?;
} }
} }