Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Log errors when COBs can't load
cloudhead committed 1 year ago
commit bfc949d094d9b9367259cfae7e20f32c9099ffc8
parent 2b750456615b3bdd68bddb3d74df3adfc3bd2a8a
4 files changed +27 -9
modified radicle-cli/src/commands/inbox.rs
@@ -306,9 +306,13 @@ where
        } = match &n.kind {
            NotificationKind::Branch { name } => NotificationRow::branch(name, head, &n, &repo)?,
            NotificationKind::Cob { typed_id } => {
-
                match NotificationRow::cob(typed_id, &n, &issues, &patches, &repo)? {
-
                    Some(row) => row,
-
                    None => continue,
+
                match NotificationRow::cob(typed_id, &n, &issues, &patches, &repo) {
+
                    Ok(Some(row)) => row,
+
                    Ok(None) => continue,
+
                    Err(e) => {
+
                        log::error!(target: "cli", "Error loading notification for {typed_id}: {e}");
+
                        continue;
+
                    }
                }
            }
            NotificationKind::Unknown { refname } => {
modified radicle-cli/src/commands/issue.rs
@@ -632,9 +632,13 @@ where
    let mut all = Vec::new();
    let issues = cache.list()?;
    for result in issues {
-
        let Ok((id, issue)) = result else {
-
            // Skip issues that failed to load.
-
            continue;
+
        let (id, issue) = match result {
+
            Ok((id, issue)) => (id, issue),
+
            Err(e) => {
+
                // Skip issues that failed to load.
+
                log::error!(target: "cli", "Issue load error: {e}");
+
                continue;
+
            }
        };

        if let Some(a) = assignee {
modified radicle-cli/src/commands/patch/list.rs
@@ -29,9 +29,13 @@ pub fn run(
        None => patches.list()?,
    };
    for patch in iter {
-
        let Ok((id, patch)) = patch else {
-
            // Skip patches that failed to load.
-
            continue;
+
        let (id, patch) = match patch {
+
            Ok((id, patch)) => (id, patch),
+
            Err(e) => {
+
                // Skip patches that failed to load.
+
                log::error!(target: "cli", "Patch load error: {e}");
+
                continue;
+
            }
        };
        if !authors.is_empty() {
            if !authors.contains(patch.author().id()) {
modified radicle/src/cob.rs
@@ -29,6 +29,12 @@ pub struct TypedId {
    pub type_name: TypeName,
}

+
impl std::fmt::Display for TypedId {
+
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+
        write!(f, "{}/{}", self.type_name, self.id)
+
    }
+
}
+

/// Errors that occur when parsing a Git refname into a [`TypedId`].
#[derive(Debug, thiserror::Error)]
pub enum ParseIdentifierError {