2ae9196
ZhenYi
feat(lib/git): add HTTP handler tree with routes and errors across analysis, archives, blobs, branches, commits, conflicts, content, diffs, hooks, lfs, logs, maintenance, packs, patches, pipelines, refs, remotes, repos, signatures, submodules, tags, trees
2ae9196
use std::io;
use gitbaby::error::BabyError;
use redis::RedisError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum SyncError {
#[error("repository sync lock is held by another worker")]
Locked,
#[error("database error: {0}")]
Db(#[from] sea_orm::DbErr),
#[error("redis error: {0}")]
Redis(#[from] RedisError),
#[error("git error: {0}")]
Git(#[from] BabyError),
#[error("i/o error: {0}")]
Io(#[from] io::Error),
#[error("operation timed out: {0}")]
Timeout(&'static str),
#[error("repository not found: {0}")]
NotFound(String),
#[error("invalid sync task: {0}")]
InvalidTask(String),
#[error("internal error: {0}")]
Internal(String),
}
pub type SyncResult<T> = Result<T, SyncError>;
impl SyncError {
#[must_use]
pub fn is_locked(&self) -> bool {
matches!(self, SyncError::Locked)
}
}