tablo_core/declaration/
mount_error.rs1use std::fmt;
4
5use super::DeclarationError;
6
7#[derive(Debug)]
13pub struct MountError {
14 panel: String,
15 errors: Vec<DeclarationError>,
16}
17
18impl MountError {
19 pub(crate) fn new(panel: &str, errors: Vec<DeclarationError>) -> Self {
20 Self {
21 panel: panel.to_string(),
22 errors,
23 }
24 }
25
26 pub fn panel(&self) -> &str {
28 &self.panel
29 }
30
31 pub fn errors(&self) -> &[DeclarationError] {
33 &self.errors
34 }
35}
36
37impl fmt::Display for MountError {
38 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39 write!(f, "panel '{}' cannot mount:", self.panel)?;
40 for error in &self.errors {
41 write!(f, "\n - {error}")?;
42 }
43 Ok(())
44 }
45}
46
47impl std::error::Error for MountError {}