1use thiserror::Error;
14
15#[derive(Error, Debug)]
16pub enum GitError {
21 #[error("The `{0}` is not a valid git object type.")]
23 InvalidObjectType(String),
24
25 #[error("The `{0}` is not a valid git blob object.")]
27 InvalidBlobObject(String),
28
29 #[error("Not a valid git tree object.")]
31 InvalidTreeObject,
32
33 #[error("The `{0}` is not a valid git tree item.")]
35 InvalidTreeItem(String),
36
37 #[error("`{0}`.")]
39 EmptyTreeItems(String),
40
41 #[error("The `{0}` is not a valid git commit signature.")]
43 InvalidSignatureType(String),
44
45 #[error("Not a valid git commit object.")]
47 InvalidCommitObject,
48
49 #[error("Invalid Commit: {0}")]
51 InvalidCommit(String),
52
53 #[error("Not a valid git tag object: {0}")]
55 InvalidTagObject(String),
56
57 #[error("Not a valid git note object: {0}")]
59 InvalidNoteObject(String),
60
61 #[error("The `{0}` is not a valid idx file.")]
63 InvalidIdxFile(String),
64
65 #[error("The `{0}` is not a valid pack file.")]
67 InvalidPackFile(String),
68
69 #[error("The `{0}` is not a valid pack header.")]
71 InvalidPackHeader(String),
72
73 #[error("The `{0}` is not a valid index file.")]
75 InvalidIndexFile(String),
76
77 #[error("The `{0}` is not a valid index header.")]
79 InvalidIndexHeader(String),
80
81 #[error("Argument parse failed: {0}")]
83 InvalidArgument(String),
84
85 #[error("IO Error: {0}")]
87 IOError(#[from] std::io::Error),
88
89 #[error("The {0} is not a valid Hash value ")]
91 InvalidHashValue(String),
92
93 #[error("Delta Object Error Info:{0}")]
95 DeltaObjectError(String),
96
97 #[error("The object to be packed is incomplete ,{0}")]
99 UnCompletedPackObject(String),
100
101 #[error("Error decode in the Object ,info:{0}")]
103 InvalidObjectInfo(String),
104
105 #[error("Cannot find Hash value: {0} from current file")]
107 NotFoundHashValue(String),
108
109 #[error("Can't encode the object which id [{0}] to bytes")]
111 EncodeObjectError(String),
112
113 #[error("UTF-8 conversion error: {0}")]
115 ConversionError(String),
116
117 #[error("Can't find parent tree by path: {0}")]
119 InvalidPathError(String),
120
121 #[error("Can't encode entries to pack: {0}")]
123 PackEncodeError(String),
124
125 #[error("Can't find specific object: {0}")]
127 ObjectNotFound(String),
128
129 #[error("Repository not found")]
131 RepoNotFound,
132
133 #[error("UnAuthorized: {0}")]
135 UnAuthorized(String),
136
137 #[error("Network Error: {0}")]
139 NetworkError(String),
140
141 #[error("{0}")]
143 CustomError(String),
144}