From e075e90040e82184435fa5a8f8c6330ed6655ff2 Mon Sep 17 00:00:00 2001 From: Ernest Ng Date: Fri, 19 Sep 2025 14:15:38 -0400 Subject: [PATCH] Attempt to figure out how to emit MaxStepsReached error --- interp/src/main.rs | 1 + protocols/src/errors.rs | 7 +++++-- protocols/src/scheduler.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/interp/src/main.rs b/interp/src/main.rs index fab820d3..3ec49ff2 100644 --- a/interp/src/main.rs +++ b/interp/src/main.rs @@ -113,6 +113,7 @@ fn main() -> Result<(), Box> { cli.max_steps.unwrap_or(u32::MAX), ); let results = scheduler.execute_todos(); + scheduler.emit_all_diagnostics(); // Check whether the protocol was executed successfully for res in results { diff --git a/protocols/src/errors.rs b/protocols/src/errors.rs index 8adf830a..3df25b00 100644 --- a/protocols/src/errors.rs +++ b/protocols/src/errors.rs @@ -373,8 +373,11 @@ impl DiagnosticEmitter { ExecutionError::Assertion(assert_err) => { Self::emit_assertion_error(handler, assert_err, transaction, symbol_table); } - ExecutionError::MaxStepsReached(_) => { - handler.emit_general_message(&format!("{error}"), Level::Error); + ExecutionError::MaxStepsReached(max_steps) => { + let thread_err = ThreadError::ExecutionLimitExceeded { + max_steps: *max_steps as usize, + }; + Self::emit_thread_error(handler, &thread_err, transaction, symbol_table); } } } diff --git a/protocols/src/scheduler.rs b/protocols/src/scheduler.rs index 28f52ae8..776e8196 100644 --- a/protocols/src/scheduler.rs +++ b/protocols/src/scheduler.rs @@ -349,7 +349,7 @@ impl<'a> Scheduler<'a> { self.results.clone() } - fn emit_all_diagnostics(&mut self) { + pub fn emit_all_diagnostics(&mut self) { // results and todos are parallel arrays, so we can use the same idx for (idx, result) in self.results.iter().enumerate() { if let Err(error) = result {