Skip to content

Commit

Permalink
show failed source on title
Browse files Browse the repository at this point in the history
  • Loading branch information
shouya committed Sep 20, 2024
1 parent f5c14ea commit 76669e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/filter/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ impl FeedFilter for Merge {
}

for (source, error) in errors {
let title = "Failed fetching source".to_owned();
let source_url = source.full_url(ctx).map(|u| u.to_string());
let title = match source_url.as_ref() {
Some(url) => format!("Error fetching source: {}", url),
None => "Error: Failed fetching source".to_owned(),
};
let source_desc = source_url
.clone()
.unwrap_or_else(|| format!("{:?}", source));

let body = format!("<p>Source: {source_desc}</p><p>Error: {error}</p>");
let body =
format!("<p>Source:<br>{source_desc}</p><p>Error:<br>{error}</p>");
feed.add_item(title, body, source_url.unwrap_or_default());
}

Expand Down

0 comments on commit 76669e1

Please sign in to comment.