use thiserror::Error;
#[derive(Debug, Error)]
pub enum FooterError {
#[error("footer configuration is required but missing")]
MissingFooterConfig,
#[error("footer is required but missing")]
MissingFooter,
#[error(
"insufficient blank lines before footer, expected {min_line}, but found {current_line}"
)]
BlankLinesBeforeFooterNotEnough {
min_line: usize,
current_line: usize,
},
#[error("invalid footer start keyword, expected one of {allowed:?}, but found {actual}")]
FooterStartKeywordInvalid {
allowed: Vec<String>,
actual: String,
},
#[error(
"invalid length for footer line {line_number}, expected {min} ≤ length ≤ {max}, but found {actual}"
)]
FooterLineLengthInvalid {
line_number: usize,
min: usize,
max: usize,
actual: usize,
},
#[error("footer line {line_number} contains trailing whitespace")]
FooterTrailingWhitespace { line_number: usize },
#[error(
"footer keyword appears misspelled:\n \"{wrong}\" → \"{correct}\"\n similarity = {similarity:.2} (threshold = {threshold:.2})"
)]
FooterKeywordTypoError {
wrong: String,
correct: String,
similarity: f64,
threshold: f64,
},
}