Show artifacts on failure

This commit is contained in:
greg 2018-04-24 23:11:04 -07:00
parent 8e42f7e0bc
commit a1016293ac

View File

@ -92,8 +92,6 @@ impl UnfinishedComputation {
impl FinishedComputation {
pub fn to_repl(&self) -> String {
match self.text_output {
Ok(ref output) => {
let mut buf = String::new();
for stage in ["tokens", "parse_trace", "ast", "symbol_table", "type_check"].iter() {
if let Some(artifact) = self.artifacts.get(&stage.to_string()) {
@ -103,12 +101,12 @@ impl FinishedComputation {
write!(&mut buf, "{}: {}\n", stage, output).unwrap();
}
}
write!(&mut buf, "{}", output).unwrap();
match self.text_output {
Ok(ref output) => write!(&mut buf, "{}", output).unwrap(),
Err(ref err) => write!(&mut buf, "{} {}", "Error: ".red().bold(), err).unwrap(),
}
buf
}
Err(ref s) => format!("{} {}", "Error: ".red().bold(), s)
}
}
pub fn to_noninteractive(&self) -> Option<String> {
match self.text_output {
Ok(_) => {