cli: Log errors when COBs can't load

This commit is contained in:
cloudhead 2024-08-09 10:46:45 +02:00
parent 2b75045661
commit bfc949d094
No known key found for this signature in database
4 changed files with 27 additions and 9 deletions

View File

@ -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 } => {

View File

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

View File

@ -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()) {

View File

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