aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/rust/app.rs17
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)]