// pub type Result = core::result::Result; #[derive(Debug, derive_more::Display)] pub enum Error { Lock, #[display("File not found: {}", 0)] NotFound(String), #[display("Unable to parse file contents")] ParseContent, #[display("Unable to decode from base64")] DecodeFromBase64, #[display("Unable to decode from UTF-8")] DecodeFromUtf8, #[display("Unknown file encoding: {}", 0)] UnknownEncoding(String), #[display("Not a file: {}", 0)] NotFile(String), #[display("Unknown error (status: {})", 0)] Unknown(String), CommitLog(crate::commit::log::Error), CommitNotFound, NoTreeInCommit(String), NoGitNextToml, FindReference(String), FindObject(String), NonUtf8Blob(String), TryId, } impl std::error::Error for Error {} impl From for Error { fn from(value: crate::commit::log::Error) -> Self { Self::CommitLog(value) } } impl From for Error { fn from(value: gix::reference::find::existing::Error) -> Self { Self::FindReference(value.to_string()) } } impl From for Error { fn from(value: gix::object::commit::Error) -> Self { Self::NoTreeInCommit(value.to_string()) } } impl From for Error { fn from(value: gix::object::find::existing::Error) -> Self { Self::FindObject(value.to_string()) } } impl From for Error { fn from(value: std::string::FromUtf8Error) -> Self { Self::NonUtf8Blob(value.to_string()) } }