mirror of
https://codeberg.org/icewind/docker-hub-rss.git
synced 2026-06-03 18:24:06 +02:00
error handling cleanup?
This commit is contained in:
parent
919e6bbeef
commit
7db673e176
1 changed files with 2 additions and 11 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -32,25 +32,16 @@ async fn main() -> Result<()> {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct ReportRejection(Report);
|
struct ReportRejection(Report);
|
||||||
|
|
||||||
impl From<Report> for ReportRejection {
|
|
||||||
fn from(report: Report) -> Self {
|
|
||||||
Self(report)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Reject for ReportRejection {}
|
impl Reject for ReportRejection {}
|
||||||
|
|
||||||
async fn feed(user: String, repo: String, hub: Hub) -> Result<impl warp::Reply, Rejection> {
|
async fn feed(user: String, repo: String, hub: Hub) -> Result<impl warp::Reply, Rejection> {
|
||||||
feed_inner(user, repo, hub)
|
feed_inner(user, repo, hub)
|
||||||
.await
|
.await
|
||||||
|
.map_err(ReportRejection)
|
||||||
.map_err(warp::reject::custom)
|
.map_err(warp::reject::custom)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn feed_inner(
|
async fn feed_inner(user: String, repo: String, hub: Hub) -> Result<impl warp::Reply> {
|
||||||
user: String,
|
|
||||||
repo: String,
|
|
||||||
hub: Hub,
|
|
||||||
) -> Result<impl warp::Reply, ReportRejection> {
|
|
||||||
let repo = repo.trim_end_matches(".atom").to_string();
|
let repo = repo.trim_end_matches(".atom").to_string();
|
||||||
let mut channel: Channel = ChannelBuilder::default()
|
let mut channel: Channel = ChannelBuilder::default()
|
||||||
.title(format!("{}/{} | Docker Hub Images", user, repo))
|
.title(format!("{}/{} | Docker Hub Images", user, repo))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue