summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index bcee4ff..31fca60 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -334,3 +334,39 @@ impl SubplotError {
/// A result type for this crate.
pub type Result<T> = std::result::Result<T, SubplotError>;
+
+/// A warning, or non-fatal error.
+///
+/// Errors prevent Subplot from producing output. Warnings don't do that.
+#[derive(Debug)]
+pub enum Warning {
+ /// Document refers to an embedded file that doesn't exist.
+ UnknownEmbeddedFile(String),
+
+ /// Embedded file is not used by any scenario.
+ UnusedEmbeddedFile(String),
+
+ /// Missing step implementation.
+ MissingStepImplementation(String),
+}
+
+/// A list of warnings.
+///
+/// Subplot collects warnings into this structure so that they can be
+/// processed at the end.
+#[derive(Debug, Default)]
+pub struct Warnings {
+ warnings: Vec<Warning>,
+}
+
+impl Warnings {
+ /// Append a warning to the list.
+ pub fn push(&mut self, w: Warning) {
+ self.warnings.push(w);
+ }
+
+ /// Return a slice with all the warnings in the list.
+ pub fn warnings(&self) -> &[Warning] {
+ &self.warnings
+ }
+}