diff options
| author | Kevin Hoerr <kjhoerr@submelon.dev> | 2026-03-02 23:05:26 +0000 |
|---|---|---|
| committer | Kevin Hoerr <kjhoerr@submelon.dev> | 2026-03-02 23:05:26 +0000 |
| commit | e0653a14e28ca6a7d6a8686c95785461df01b52f (patch) | |
| tree | 022dbe5ead7379efaf0b2d68aea4086f2bc0cc54 /src/main/rust | |
| parent | f85820b1af223846b44e5570cb62ae13970023a7 (diff) | |
| download | equity-tracker-e0653a14e28ca6a7d6a8686c95785461df01b52f.tar.gz equity-tracker-e0653a14e28ca6a7d6a8686c95785461df01b52f.tar.bz2 equity-tracker-e0653a14e28ca6a7d6a8686c95785461df01b52f.zip | |
app.rs: Track soft error state
Diffstat (limited to 'src/main/rust')
| -rw-r--r-- | src/main/rust/app.rs | 17 |
1 files changed, 16 insertions, 1 deletions
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<ErrReport>, 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<ErrReport> { + &self.error + } + + pub fn clear_error(&mut self) -> Result<()> { + self.error = None; + Ok(()) + } } #[cfg(test)] |
