foundry_config/inline/
error.rs#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
pub enum InlineConfigParserError {
#[error("'{0}' is an invalid config property")]
InvalidConfigProperty(String),
#[error("'{0}' specifies an invalid profile. Available profiles are: {1}")]
InvalidProfile(String, String),
#[error("Invalid config value for key '{0}'. Unable to parse '{1}' into an integer value")]
ParseInt(String, String),
#[error("Invalid config value for key '{0}'. Unable to parse '{1}' into a boolean value")]
ParseBool(String, String),
}
#[derive(Debug, thiserror::Error)]
#[error("Inline config error detected at {line}")]
pub struct InlineConfigError {
pub line: String,
pub source: InlineConfigParserError,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn can_format_inline_config_errors() {
let source = InlineConfigParserError::ParseBool("key".into(), "invalid-bool-value".into());
let line = "dir/TestContract.t.sol:FuzzContract".to_string();
let error = InlineConfigError { line: line.clone(), source };
let expected = format!("Inline config error detected at {line}");
assert_eq!(error.to_string(), expected);
}
}