summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-04-02 09:50:39 +0300
committerLars Wirzenius <liw@liw.fi>2022-04-10 15:57:57 +0300
commit85212e8ddc54c6ede71912127eaf84aac403f10d (patch)
tree3d6a86f55231ace670ecdf1a6b42b237db2632f8 /src/error.rs
parenta3d768162e70004d207a40d803f5d17eeea8593a (diff)
downloadsubplot-85212e8ddc54c6ede71912127eaf84aac403f10d.tar.gz
feat! treat warnings as errors by default
Add a --merciful option to subcommands for which this matters. Adjust tests to invoke subplot with that option as necessary. Sponsored-by: author
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/error.rs b/src/error.rs
index 31fca60..6e7eddd 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -8,6 +8,10 @@ use thiserror::Error;
/// Define all the kinds of errors any part of this crate can return.
#[derive(Debug, Error)]
pub enum SubplotError {
+ /// Document has non-fatal errors.
+ #[error("Document has {0} warnings.")]
+ Warnings(usize),
+
/// Subplot could not find a file named as a bindings file.
#[error("binding file could not be found: {0}: {1}")]
BindingsFileNotFound(PathBuf, std::io::Error),
@@ -338,16 +342,21 @@ 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)]
+#[derive(Debug, thiserror::Error)]
pub enum Warning {
/// Document refers to an embedded file that doesn't exist.
- UnknownEmbeddedFile(String),
+ #[error(
+ "Document refers to an embedded file that doesn't exist: \"{1}\"\n in scenario \"{0}\""
+ )]
+ UnknownEmbeddedFile(String, String),
/// Embedded file is not used by any scenario.
+ #[error("Embedded file is not used by any scenario: \"{0}\"")]
UnusedEmbeddedFile(String),
/// Missing step implementation.
- MissingStepImplementation(String),
+ #[error("Missing step implementation: \"{1}\"\n in scenario \"{0}\"")]
+ MissingStepImplementation(String, String),
}
/// A list of warnings.