prelude_xml_parser/
errors.rs

1use std::path::PathBuf;
2
3use thiserror::Error;
4
5/// An enum representing the errors that can occur.
6#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum Error {
9    /// The file is not a XML file.
10    #[error("File {:?} is not a XML file.", 0)]
11    InvalidFileType(PathBuf),
12
13    /// The file was not found at the specififed path.
14    #[error("File was not found at the specified path: {:?}.", 0)]
15    FileNotFound(PathBuf),
16
17    /// An io error occurred.
18    #[error(transparent)]
19    IO(#[from] std::io::Error),
20
21    /// A parsing error occurred.
22    #[error(transparent)]
23    ParsingError(#[from] serde_xml_rs::Error),
24
25    /// An unknown error occurred.
26    #[error("Unknown error")]
27    Unknown,
28}