use std::fmt;
use std::path::PathBuf;
use crate::report::display_path;
#[derive(Debug, Clone)]
pub struct TableFailure {
pub table: String,
pub reason: String,
pub path: Option<PathBuf>,
pub line: Option<usize>,
pub schema: Option<String>,
}
impl fmt::Display for TableFailure {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let (Some(path), Some(line)) = (&self.path, self.line) {
write!(f, "{}:{line}: ", display_path(path))?;
}
write!(f, "table `{}`: {}", self.table, self.reason)
}
}