diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-02 12:40:52 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-10 15:57:57 +0300 |
commit | c9627df005b5344f437c9eaaa98bb5fe00c47313 (patch) | |
tree | 2ef11b14d1c6f3600fe3e806720d324b38b4d7fe /src/error.rs | |
parent | 85212e8ddc54c6ede71912127eaf84aac403f10d (diff) | |
download | subplot-c9627df005b5344f437c9eaaa98bb5fe00c47313.tar.gz |
feat: make typesetting issues into warnings
Sponsored-by: author
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 6e7eddd..13d6a6c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -342,7 +342,7 @@ 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, thiserror::Error)] +#[derive(Debug, Clone, thiserror::Error)] pub enum Warning { /// Document refers to an embedded file that doesn't exist. #[error( @@ -357,6 +357,10 @@ pub enum Warning { /// Missing step implementation. #[error("Missing step implementation: \"{1}\"\n in scenario \"{0}\"")] MissingStepImplementation(String, String), + + /// Unknown binding when typesetting a scenario. + #[error("Unknown binding: {0}")] + UnknownBinding(String), } /// A list of warnings. @@ -374,6 +378,11 @@ impl Warnings { self.warnings.push(w); } + /// Append all warnings from one list to another. + pub fn push_all(&mut self, mut other: Warnings) { + self.warnings.append(&mut other.warnings); + } + /// Return a slice with all the warnings in the list. pub fn warnings(&self) -> &[Warning] { &self.warnings |