use std::fmt;
use thiserror::Error;
#[derive(Debug)]
pub struct DirectiveError {
pub line: usize,
pub col: usize,
pub message: String,
}
#[derive(Error, Debug)]
pub struct DirectiveErrors {
pub filename: String,
pub errors: Vec<DirectiveError>,
}
impl fmt::Display for DirectiveErrors {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "Failed directives on {}:", self.filename)?;
for error in self.errors.iter() {
writeln!(f, " • {} ({}:{})", error.message, error.line, error.col)?;
}
Ok(())
}
}