From 94ea7bcd09353c6c494583c4ecd2b0f30a8ba3f6 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 15 May 2019 03:32:57 -0700 Subject: [PATCH] Starting to use more advanced error output --- schala-repl/src/repl/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/schala-repl/src/repl/mod.rs b/schala-repl/src/repl/mod.rs index bfd5d63..9eb1924 100644 --- a/schala-repl/src/repl/mod.rs +++ b/schala-repl/src/repl/mod.rs @@ -189,14 +189,20 @@ impl Repl { }; let ref mut language_state = self.get_cur_language_state(); + let response = language_state.run_computation(request); - let ComputationResponse { main_output, global_output_stats, debug_responses } - = language_state.run_computation(request); + self.handle_computation_response(response) + } - match main_output { + fn handle_computation_response(&mut self, response: ComputationResponse) -> String { + let mut buf = String::new(); + + buf.push_str(&match response.main_output { Ok(s) => s, Err(e) => format!("{} {}", "Error".red(), e) - } + }); + + buf } fn get_directives(&mut self) -> CommandTree {