1use std::{fmt, io};
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Copy, Clone, Eq, PartialEq, Debug)]
6pub enum Error {
7 CannotFindBinaryPath,
9 CannotGetCurrentDirAndPathListEmpty,
11 CannotCanonicalize,
13}
14
15impl std::error::Error for Error {}
16
17impl fmt::Display for Error {
18 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19 match self {
20 Error::CannotFindBinaryPath => write!(f, "cannot find binary path"),
21 Error::CannotGetCurrentDirAndPathListEmpty => write!(
22 f,
23 "no path to search and provided name is not an absolute path"
24 ),
25 Error::CannotCanonicalize => write!(f, "cannot canonicalize path"),
26 }
27 }
28}
29
30#[derive(Debug)]
31#[non_exhaustive]
32pub enum NonFatalError {
33 Io(io::Error),
34 PathExtNotPopulated,
38}
39
40impl std::error::Error for NonFatalError {}
41
42impl fmt::Display for NonFatalError {
43 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 match self {
45 Self::Io(e) => write!(f, "{e}"),
46 Self::PathExtNotPopulated => write!(f, "PATHEXT environment variable is not populated, and the query did not specify a file extension"),
47 }
48 }
49}