diff --git a/crates/radicle-node/src/worker/fetch/error.rs b/crates/radicle-node/src/worker/fetch/error.rs
index a9111a6a..6c9d753f 100644
--- a/crates/radicle-node/src/worker/fetch/error.rs
+++ b/crates/radicle-node/src/worker/fetch/error.rs
@@ -71,5 +71,5 @@ pub enum Canonical {
#[error(transparent)]
Identity(#[from] radicle::storage::RepositoryError),
#[error(transparent)]
- Payload(#[from] radicle::identity::PayloadError),
+ CanonicalRefs(#[from] radicle::identity::doc::CanonicalRefsError),
}
diff --git a/crates/radicle-remote-helper/src/push.rs b/crates/radicle-remote-helper/src/push.rs
index 8d21062d..0c3f0ec0 100644
--- a/crates/radicle-remote-helper/src/push.rs
+++ b/crates/radicle-remote-helper/src/push.rs
@@ -6,7 +6,7 @@ use std::str::FromStr;
use std::{assert_eq, io};
use radicle::identity::crefs::GetCanonicalRefs as _;
-use radicle::identity::doc::DefaultBranchRuleError;
+use radicle::identity::doc::CanonicalRefsError;
use radicle::node::device::Device;
use thiserror::Error;
@@ -118,7 +118,7 @@ pub enum Error {
#[error(transparent)]
Quorum(#[from] radicle::git::canonical::QuorumError),
#[error(transparent)]
- DefaultBranchRule(#[from] radicle::identity::doc::DefaultBranchRuleError),
+ CanonicalRefs(#[from] radicle::identity::doc::CanonicalRefsError),
}
/// Push command.
@@ -271,7 +271,7 @@ pub fn run(
let identity = stored.identity()?;
let crefs = identity.canonical_refs_or_default(|| {
let rule = identity.doc().default_branch_rule()?;
- Ok::<_, DefaultBranchRuleError>(CanonicalRefs::from_iter([rule]))
+ Ok::<_, CanonicalRefsError>(CanonicalRefs::from_iter([rule]))
})?;
let rules = crefs.rules();
let me = Did::from(nid);
diff --git a/crates/radicle/src/identity/crefs.rs b/crates/radicle/src/identity/crefs.rs
index 112d5ccf..939d5b16 100644
--- a/crates/radicle/src/identity/crefs.rs
+++ b/crates/radicle/src/identity/crefs.rs
@@ -69,7 +69,7 @@ impl RawCanonicalRefs {
R: Fn() -> Delegates,
{
let rules = Rules::from_raw(self.rules, resolve)?;
- Ok(CanonicalRefs { rules })
+ Ok(CanonicalRefs::new(rules))
}
}
diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs
index 169876ae..db27c47d 100644
--- a/crates/radicle/src/identity/doc.rs
+++ b/crates/radicle/src/identity/doc.rs
@@ -241,8 +241,6 @@ impl PayloadId {
#[derive(Debug, Error)]
pub enum PayloadError {
- #[error(transparent)]
- CanonicalRefs(#[from] rules::ValidationError),
#[error("json: {0}")]
Json(#[from] serde_json::Error),
#[error("payload '{0}' not found in identity document")]
@@ -914,14 +912,32 @@ impl Doc {
}
}
+#[derive(Debug, Error)]
+pub enum CanonicalRefsError {
+ #[error(transparent)]
+ Json(#[from] serde_json::Error),
+ #[error(transparent)]
+ CanonicalRefs(#[from] rules::ValidationError),
+ #[error(transparent)]
+ DefaultBranch(#[from] DefaultBranchRuleError),
+}
+
impl crefs::GetCanonicalRefs for Doc {
- type Error = PayloadError;
+ type Error = CanonicalRefsError;
fn canonical_refs(&self) -> Result