git_next_core/git/
file.rs1pub type Result<T> = core::result::Result<T, Error>;
3
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 #[error("lock")]
7 Lock,
8
9 #[error("File not found: {}", 0)]
10 NotFound(String),
11
12 #[error("Unable to parse file contents")]
13 ParseContent,
14
15 #[error("Unable to decode from base64")]
16 DecodeFromBase64,
17
18 #[error("Unable to decode from UTF-8")]
19 DecodeFromUtf8,
20
21 #[error("Unknown file encoding: {}", 0)]
22 UnknownEncoding(String),
23
24 #[error("Not a file: {}", 0)]
25 NotFile(String),
26
27 #[error("Unknown error (status: {})", 0)]
28 Unknown(String),
29
30 #[error("commit log: {0}")]
31 CommitLog(#[from] crate::git::commit::log::Error),
32
33 #[error("commit not found")]
34 CommitNotFound,
35
36 #[error("no tree in commit")]
37 NoTreeInCommit(String),
38
39 #[error("no .git-next.toml file found in repo")]
40 FileNotFound,
41
42 #[error("find reference: {0}")]
43 FindReference(String),
44
45 #[error("find object: {0}")]
46 FindObject(String),
47
48 #[error("Non-UTF-8 in blob: {0}")]
49 NonUtf8Blob(String),
50
51 #[error("try id")]
52 TryId,
53}
54
55mod gix_errors {
56 #![cfg(not(tarpaulin_include))]
57 use crate::s;
58
59 use super::Error;
61 impl From<gix::reference::find::existing::Error> for Error {
62 fn from(value: gix::reference::find::existing::Error) -> Self {
63 Self::FindReference(s!(value))
64 }
65 }
66
67 impl From<gix::object::commit::Error> for Error {
68 fn from(value: gix::object::commit::Error) -> Self {
69 Self::NoTreeInCommit(s!(value))
70 }
71 }
72
73 impl From<gix::object::find::existing::Error> for Error {
74 fn from(value: gix::object::find::existing::Error) -> Self {
75 Self::FindObject(s!(value))
76 }
77 }
78
79 impl From<std::string::FromUtf8Error> for Error {
80 fn from(value: std::string::FromUtf8Error) -> Self {
81 Self::NonUtf8Blob(s!(value))
82 }
83 }
84}