1use std::fmt;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Copy, Clone, Eq, PartialEq, Debug)]
6pub enum Error {
7 BadAbsolutePath,
8 BadRelativePath,
9 CannotFindBinaryPath,
10 CannotGetCurrentDir,
11 CannotCanonicalize,
12}
13
14impl std::error::Error for Error {}
15
16impl fmt::Display for Error {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 Error::BadAbsolutePath => write!(f, "bad absolute path"),
20 Error::BadRelativePath => write!(f, "bad relative path"),
21 Error::CannotFindBinaryPath => write!(f, "cannot find binary path"),
22 Error::CannotGetCurrentDir => write!(f, "cannot get current directory"),
23 Error::CannotCanonicalize => write!(f, "cannot canonicalize path"),
24 }
25 }
26}
27