Improve invalid RID error

This commit is contained in:
Alexis Sellier 2023-03-22 15:17:12 +01:00
parent 654a21b2b3
commit e103ffbb95
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -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),
}

View File

@ -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.