git_internal/
errors.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GitError {
5    #[error("The `{0}` is not a valid git object type.")]
6    InvalidObjectType(String),
7
8    #[error("The `{0}` is not a valid git blob object.")]
9    InvalidBlobObject(String),
10
11    #[error("Not a valid git tree object.")]
12    InvalidTreeObject,
13
14    #[error("The `{0}` is not a valid git tree item.")]
15    InvalidTreeItem(String),
16
17    #[error("`{0}`.")]
18    EmptyTreeItems(String),
19
20    #[error("The `{0}` is not a valid git commit signature.")]
21    InvalidSignatureType(String),
22
23    #[error("Not a valid git commit object.")]
24    InvalidCommitObject,
25
26    #[error("Invalid Commit: {0}")]
27    InvalidCommit(String),
28
29    #[error("Not a valid git tag object: {0}")]
30    InvalidTagObject(String),
31
32    #[error("The `{0}` is not a valid idx file.")]
33    InvalidIdxFile(String),
34
35    #[error("The `{0}` is not a valid pack file.")]
36    InvalidPackFile(String),
37
38    #[error("The `{0}` is not a valid pack header.")]
39    InvalidPackHeader(String),
40
41    #[error("The `{0}` is not a valid index file.")]
42    InvalidIndexFile(String),
43
44    #[error("The `{0}` is not a valid index header.")]
45    InvalidIndexHeader(String),
46
47    #[error("Argument parse failed: {0}")]
48    InvalidArgument(String),
49
50    #[error("IO Error: {0}")]
51    IOError(#[from] std::io::Error),
52
53    #[error("The {0} is not a valid Hash value ")]
54    InvalidHashValue(String),
55
56    #[error("Delta Object Error Info:{0}")]
57    DeltaObjectError(String),
58
59    #[error("The object to be packed is incomplete ,{0}")]
60    UnCompletedPackObject(String),
61
62    #[error("Error decode in the Object ,info:{0}")]
63    InvalidObjectInfo(String),
64
65    #[error("Can't found Hash value :{0} from current file")]
66    NotFountHashValue(String),
67
68    #[error("Can't encode the object which id [{0}] to bytes")]
69    EncodeObjectError(String),
70
71    #[error("UTF-8 conversion error: {0}")]
72    ConversionError(String),
73
74    #[error("Can't find parent tree by path: {0}")]
75    InvalidPathError(String),
76
77    #[error("Can't encode entries to pack: {0}")]
78    PackEncodeError(String),
79
80    #[error("Can't find specific object: {0}")]
81    ObjectNotFound(String),
82
83    #[error("Repository not found")]
84    RepoNotFound,
85
86    #[error("UnAuthorized: {0}")]
87    UnAuthorized(String),
88
89    #[error("Network Error: {0}")]
90    NetworkError(String),
91
92    #[error("{0}")]
93    CustomError(String),
94}