Skip to content

Commit

Permalink
made sure that the now being ready is a proper error message rather t…
Browse files Browse the repository at this point in the history
…han being a silent error
  • Loading branch information
CommanderStorm committed May 9, 2024
1 parent 34c819c commit 6d8e56d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/main-api/src/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub async fn calendar_handler(
}
Ok(Some(loc)) => loc,
};
let Some(last_sync) = location.last_calendar_scrape_at else {
return HttpResponse::ServiceUnavailable()
.body("This calendar entry is currently in the process of being scraped, please try again later");
};
let Some(calendar_url) = location.calendar_url else {
return HttpResponse::NotFound()
.content_type("text/plain")
Expand All @@ -49,7 +53,7 @@ pub async fn calendar_handler(
match get_from_db(&data.db, &id, &args.start_after, &args.end_before).await {
Ok(events) => HttpResponse::Ok().json(models::Events {
events,
last_sync: location.last_calendar_scrape_at.unwrap(),
last_sync,
calendar_url,
}),
Err(e) => {
Expand Down

0 comments on commit 6d8e56d

Please sign in to comment.