1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum RustlocError {
9 #[error("failed to read file '{path}': {source}")]
11 FileRead {
12 path: PathBuf,
13 source: std::io::Error,
14 },
15
16 #[error("failed to parse cargo metadata: {0}")]
18 CargoMetadata(String),
19
20 #[error("invalid glob pattern '{pattern}': {message}")]
22 InvalidGlob { pattern: String, message: String },
23
24 #[error("path does not exist: {0}")]
26 PathNotFound(PathBuf),
27
28 #[error("no Cargo.toml found at or above: {0}")]
30 CargoTomlNotFound(PathBuf),
31
32 #[error("unsupported source file: {0}")]
34 UnsupportedSourceFile(PathBuf),
35
36 #[deprecated(note = "use UnsupportedSourceFile instead")]
38 #[error("not a Rust file: {0}")]
39 NotRustFile(PathBuf),
40
41 #[error("IO error: {0}")]
43 Io(#[from] std::io::Error),
44
45 #[error("git error: {0}")]
47 GitError(String),
48}