radicle: Remove unused error variants
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
98c1566109
commit
8735719ecc
|
|
@ -2,7 +2,6 @@ mod id;
|
|||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::fmt::{self, Write as _};
|
||||
use std::io;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::path::Path;
|
||||
|
|
@ -42,27 +41,18 @@ pub const MAX_DELEGATES: usize = 255;
|
|||
pub enum DocError {
|
||||
#[error("json: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
#[error("i/o: {0}")]
|
||||
Io(#[from] io::Error),
|
||||
#[error("verification: {0}")]
|
||||
Verification(#[from] VerificationError),
|
||||
#[error("payload: {0}")]
|
||||
Payload(#[from] PayloadError),
|
||||
#[error("git: {0}")]
|
||||
Git(#[from] git::Error),
|
||||
#[error("git: {0}")]
|
||||
RawGit(#[from] git2::Error),
|
||||
#[error("storage: {0}")]
|
||||
Storage(#[from] storage::Error),
|
||||
#[error("git: reference `{0}` was not found")]
|
||||
NotFound(git::RefString),
|
||||
}
|
||||
|
||||
impl DocError {
|
||||
/// Whether this error is caused by the document not being found.
|
||||
pub fn is_not_found(&self) -> bool {
|
||||
match self {
|
||||
Self::NotFound(_) => true,
|
||||
Self::Git(git::Error::NotFound(_)) => true,
|
||||
Self::Git(git::Error::Git(e)) if git::is_not_found_err(e) => true,
|
||||
_ => false,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use radicle_cob::{self as cob, change};
|
|||
|
||||
use crate::git;
|
||||
use crate::identity;
|
||||
use crate::identity::project::{Identity, IdentityError, Project};
|
||||
use crate::identity::project::{Identity, IdentityError, Project, VerificationError};
|
||||
use crate::identity::{Doc, Id};
|
||||
use crate::storage::refs;
|
||||
use crate::storage::refs::{Refs, SignedRefs};
|
||||
|
|
@ -43,8 +43,8 @@ pub enum ProjectError {
|
|||
Doc(#[from] identity::project::DocError),
|
||||
#[error("payload error: {0}")]
|
||||
Payload(#[from] identity::project::PayloadError),
|
||||
#[error("identity verification error: {0}")]
|
||||
Verify(#[from] identity::project::VerificationError),
|
||||
#[error("verification error: {0}")]
|
||||
Verification(#[from] VerificationError),
|
||||
#[error("git: {0}")]
|
||||
Git(#[from] git2::Error),
|
||||
#[error("git: {0}")]
|
||||
|
|
@ -176,12 +176,8 @@ pub enum VerifyError {
|
|||
InvalidRemote(RemoteId),
|
||||
#[error("invalid target `{2}` for reference `{1}` of remote `{0}`")]
|
||||
InvalidRefTarget(RemoteId, RefString, git2::Oid),
|
||||
#[error("invalid reference")]
|
||||
InvalidRef,
|
||||
#[error("invalid identity: {0}")]
|
||||
InvalidIdentity(#[from] IdentityError),
|
||||
#[error("ref error: {0}")]
|
||||
Ref(#[from] git::RefError),
|
||||
#[error("refs error: {0}")]
|
||||
Refs(#[from] refs::Error),
|
||||
#[error("unknown reference `{1}` in remote `{0}`")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue