Skip to content

Commit

Permalink
improved the logging around failed calendar downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jul 24, 2024
1 parent 9be397e commit c68216f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions server/main-api/src/calendar/connectum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,28 @@ impl APIRequestor {
pub(crate) async fn refresh(&self, id: String) -> Result<(), crate::BoxedError> {
let sync_start = Utc::now();
let url = format!("https://campus.tum.de/tumonline/co/connectum/api/rooms/{id}/calendars");
let events: Vec<Event> = self
let events = self
.client
.get(url)
.get(&url)
.bearer_auth(self.unwrap_token())
.send()
.await?
.json()
.await?;
debug!(
"finished fetching for {cnt} calendar events of {id}",
cnt = events.len(),
);
.json::<Vec<Event>>()
.await;
let events = match events {
Ok(events) => {
debug!(
"finished fetching for {cnt} calendar events of {id}",
cnt = events.len(),
);
events
}
Err(e) => {
warn!("cannot download {url} because {e:?}");
return Err(e.into());
}
};

let events = events
.into_iter()
.map(|mut e| {
Expand Down

0 comments on commit c68216f

Please sign in to comment.