Paul Campbell
f259179274
All checks were successful
Rust / build (push) Successful in 2m19s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
74 lines
1.6 KiB
Rust
74 lines
1.6 KiB
Rust
//
|
|
pub type Result<T> = core::result::Result<T, Error>;
|
|
|
|
#[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<crate::commit::log::Error> for Error {
|
|
fn from(value: crate::commit::log::Error) -> Self {
|
|
Self::CommitLog(value)
|
|
}
|
|
}
|
|
impl From<gix::reference::find::existing::Error> for Error {
|
|
fn from(value: gix::reference::find::existing::Error) -> Self {
|
|
Self::FindReference(value.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<gix::object::commit::Error> for Error {
|
|
fn from(value: gix::object::commit::Error) -> Self {
|
|
Self::NoTreeInCommit(value.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<gix::object::find::existing::Error> for Error {
|
|
fn from(value: gix::object::find::existing::Error) -> Self {
|
|
Self::FindObject(value.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<std::string::FromUtf8Error> for Error {
|
|
fn from(value: std::string::FromUtf8Error) -> Self {
|
|
Self::NonUtf8Blob(value.to_string())
|
|
}
|
|
}
|