Improve invalid RID error
This commit is contained in:
parent
654a21b2b3
commit
e103ffbb95
|
|
@ -20,7 +20,7 @@ use crate::git::{Qualified, RefError, RefString};
|
||||||
use crate::identity;
|
use crate::identity;
|
||||||
use crate::identity::doc::DocError;
|
use crate::identity::doc::DocError;
|
||||||
use crate::identity::Did;
|
use crate::identity::Did;
|
||||||
use crate::identity::{Id, IdError, IdentityError};
|
use crate::identity::{Id, IdentityError};
|
||||||
use crate::storage::refs::Refs;
|
use crate::storage::refs::Refs;
|
||||||
|
|
||||||
use self::refs::SignedRefs;
|
use self::refs::SignedRefs;
|
||||||
|
|
@ -94,8 +94,8 @@ pub enum Error {
|
||||||
Refs(#[from] refs::Error),
|
Refs(#[from] refs::Error),
|
||||||
#[error("git: {0}")]
|
#[error("git: {0}")]
|
||||||
Git(#[from] git2::Error),
|
Git(#[from] git2::Error),
|
||||||
#[error("id: {0}")]
|
#[error("invalid repository identifier {0:?}")]
|
||||||
Id(#[from] IdError),
|
Id(std::ffi::OsString),
|
||||||
#[error("i/o: {0}")]
|
#[error("i/o: {0}")]
|
||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ impl Storage {
|
||||||
|
|
||||||
for result in fs::read_dir(&self.path)? {
|
for result in fs::read_dir(&self.path)? {
|
||||||
let path = result?;
|
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)?;
|
let repo = self.repository(rid)?;
|
||||||
|
|
||||||
// For performance reasons, we don't do a full repository check here.
|
// For performance reasons, we don't do a full repository check here.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue