mini_builder_rs/builder/
builder_error.rs

1#[derive(Debug)]
2pub enum BuilderError {
3	IoError(std::io::Error),
4	InvalidDirectories,
5}
6
7impl std::fmt::Display for BuilderError {
8	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9		match self {
10			Self::IoError(err) => write!(f, "{}", err),
11			Self::InvalidDirectories => write!(
12				f,
13				"Invalid directories, ensure that none of the directories contain each other."
14			),
15		}
16	}
17}
18
19impl std::error::Error for BuilderError {
20	fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
21		match self {
22			Self::IoError(err) => Some(err.clone()),
23			Self::InvalidDirectories => None,
24		}
25	}
26}
27
28impl From<std::io::Error> for BuilderError {
29	fn from(err: std::io::Error) -> Self {
30		Self::IoError(err)
31	}
32}