From e0653a14e28ca6a7d6a8686c95785461df01b52f Mon Sep 17 00:00:00 2001 From: Kevin Hoerr Date: Mon, 2 Mar 2026 23:05:26 +0000 Subject: app.rs: Track soft error state --- src/main/rust/app.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/main/rust/app.rs') diff --git a/src/main/rust/app.rs b/src/main/rust/app.rs index d6e84e1..2ed7c28 100644 --- a/src/main/rust/app.rs +++ b/src/main/rust/app.rs @@ -1,10 +1,11 @@ use crate::store::{Context, Store}; -use miette::{Diagnostic, Result}; +use miette::{Diagnostic, ErrReport, Result}; use thiserror::Error; #[derive(Default)] pub struct App { context: Context, + error: Option, exit: bool, } @@ -71,6 +72,20 @@ impl App { .map(|u| u.to_string()) .unwrap_or("Error".into()) } + + pub fn set_error(&mut self, error: ErrReport) -> Result<()> { + self.error = Some(error); + Ok(()) + } + + pub fn get_error(&self) -> &Option { + &self.error + } + + pub fn clear_error(&mut self) -> Result<()> { + self.error = None; + Ok(()) + } } #[cfg(test)] -- cgit v1.3