From e103ffbb95159c58e4f6d7c24db3dec1fed98b86 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Wed, 22 Mar 2023 15:17:12 +0100 Subject: [PATCH] Improve invalid RID error --- radicle/src/storage.rs | 6 +++--- radicle/src/storage/git.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/radicle/src/storage.rs b/radicle/src/storage.rs index db78e01f..7bfb8f00 100644 --- a/radicle/src/storage.rs +++ b/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), } diff --git a/radicle/src/storage/git.rs b/radicle/src/storage/git.rs index 45aef2a8..6139865c 100644 --- a/radicle/src/storage/git.rs +++ b/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.