Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Improve invalid RID error
Alexis Sellier committed 3 years ago
commit e103ffbb95159c58e4f6d7c24db3dec1fed98b86
parent 654a21b2b38efb85742423538dee110fbc356f01
2 files changed +4 -4
modified radicle/src/storage.rs
@@ -20,7 +20,7 @@ use crate::git::{Qualified, RefError, RefString};
use crate::identity;
use crate::identity::doc::DocError;
use crate::identity::Did;
-
use crate::identity::{Id, IdError, IdentityError};
+
use crate::identity::{Id, IdentityError};
use crate::storage::refs::Refs;

use self::refs::SignedRefs;
@@ -94,8 +94,8 @@ pub enum Error {
    Refs(#[from] refs::Error),
    #[error("git: {0}")]
    Git(#[from] git2::Error),
-
    #[error("id: {0}")]
-
    Id(#[from] IdError),
+
    #[error("invalid repository identifier {0:?}")]
+
    Id(std::ffi::OsString),
    #[error("i/o: {0}")]
    Io(#[from] io::Error),
}
modified radicle/src/storage/git.rs
@@ -140,7 +140,7 @@ impl Storage {

        for result in fs::read_dir(&self.path)? {
            let path = result?;
-
            let rid = Id::try_from(path.file_name())?;
+
            let rid = Id::try_from(path.file_name()).map_err(|_| Error::Id(path.file_name()))?;
            let repo = self.repository(rid)?;

            // For performance reasons, we don't do a full repository check here.