#[derive(Debug, Clone, Default)]
pub struct ErrorContext {
pub file_path: Option<String>,
pub line_number: Option<u32>,
pub element_path: Option<String>,
pub operation: Option<String>,
}
impl ErrorContext {
pub fn new() -> Self {
Self::default()
}
pub fn with_file_path(mut self, path: &str) -> Self {
self.file_path = Some(path.to_string());
self
}
pub fn with_line_number(mut self, line: u32) -> Self {
self.line_number = Some(line);
self
}
pub fn with_element_path(mut self, path: &str) -> Self {
self.element_path = Some(path.to_string());
self
}
pub fn with_operation(mut self, op: &str) -> Self {
self.operation = Some(op.to_string());
self
}
}