1use std::path::PathBuf;
2
3#[derive(thiserror::Error, Clone, Debug)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("File not found {0}")]
9 FileNotFound(String),
10
11 #[error("Error opening file {}: {1}", .0.display())]
13 FileOpen(PathBuf, String),
14
15 #[error("Error fetching file {0}: {1}")]
17 RemoteFetch(String, String),
18
19 #[error("Could not read file {0}")]
21 LoadError(String),
22
23 #[error("Can not fetch directory bytes {}", .0.display())]
25 IsDirectory(PathBuf),
26
27 #[error("Could not parse location format: {0}")]
29 Parse(String),
30}
31
32impl From<std::io::Error> for Error {
33 fn from(e: std::io::Error) -> Self {
34 Self::LoadError(e.to_string())
35 }
36}