1use std::path::PathBuf;
2
3pub type Result<T, E = Error> = std::result::Result<T, E>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("io: {0}")]
8 Io(#[from] std::io::Error),
9
10 #[error("utf8: {0}")]
11 Utf8(#[from] std::string::FromUtf8Error),
12
13 #[error("parse int: {0}")]
14 ParseInt(#[from] std::num::ParseIntError),
15
16 #[error("not a valid hex char: {0}")]
17 InvalidHexByte(u8),
18
19 #[error("invalid commit header: {0}")]
20 InvalidCommitHeader(String),
21
22 #[error("current directory is not in a repository")]
23 CurrentDirectoryNotInRepository,
24
25 #[error("this path isn't a repository: {0}")]
26 PathIsNotRepository(PathBuf),
27
28 #[error("wrong object id length: expecting 40, got {0}")]
29 ObjectIdWrongLength(usize),
30
31 #[error("invalid object type: {0}")]
32 BadGitObjectType(String),
33}