Skip to main content

office_rs/error/
context.rs

1#[derive(Debug, Clone, Default)]
2pub struct ErrorContext {
3    pub file_path: Option<String>,
4    pub line_number: Option<u32>,
5    pub element_path: Option<String>,
6    pub operation: Option<String>,
7}
8
9impl ErrorContext {
10    pub fn new() -> Self {
11        Self::default()
12    }
13
14    pub fn with_file_path(mut self, path: &str) -> Self {
15        self.file_path = Some(path.to_string());
16        self
17    }
18
19    pub fn with_line_number(mut self, line: u32) -> Self {
20        self.line_number = Some(line);
21        self
22    }
23
24    pub fn with_element_path(mut self, path: &str) -> Self {
25        self.element_path = Some(path.to_string());
26        self
27    }
28
29    pub fn with_operation(mut self, op: &str) -> Self {
30        self.operation = Some(op.to_string());
31        self
32    }
33
34    // Builder pattern methods for other fields...
35}