summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_invitation-mailer/src/main.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/_invitation-mailer/src/main.rs b/_invitation-mailer/src/main.rs
index 369d6fe..f1ff25f 100644
--- a/_invitation-mailer/src/main.rs
+++ b/_invitation-mailer/src/main.rs
@@ -118,18 +118,21 @@ impl HackNight {
let event = document.select("article.event").iter().next()
.ok_or_else(|| anyhow!("Could not find event in html file"))?;
- let year = event.select("p.event-year").text().to_string().parse::<i32>()?;
- let month = month_number(event.select("p.event-month").text().to_string().as_str())?;
- let day = event.select("p.event-day").text().to_string().parse::<u32>()?;
+ let year = event.select("p.event-year").text().to_string().parse::<i32>()
+ .context("event-year")?;
+ let month = month_number(event.select("p.event-month").text().to_string().as_str())
+ .context("event-month")?;
+ let day = event.select("p.event-day").text().to_string().parse::<u32>()
+ .context("event-day")?;
let timespan = event.select("dl.dl-horizontal > dd").iter().last()
.ok_or_else(|| anyhow!("No venue timespan found"))?.text().to_string();
let (start_str, end_str) = timespan.split_once('—')
.ok_or_else(|| anyhow!("Couldn't split timespan"))?;
- let start_hh = start_str[0..=1].parse::<u32>()?;
- let start_mm = start_str[3..=4].parse::<u32>()?;
- let end_hh: u32 = end_str[0..=1].parse()?;
- let end_mm: u32 = end_str[3..=4].parse()?;
+ let start_hh = start_str[0..=1].parse::<u32>().context("Start hour")?;
+ let start_mm = start_str[3..=4].parse::<u32>().context("Start minute")?;
+ let end_hh: u32 = end_str[0..=1].parse().context("End hour")?;
+ let end_mm: u32 = end_str[3..=4].parse().context("End minute")?;
let description = event.select("div.event-desc");
let title = event.select("h3.event-desc-header").text().to_string().trim().to_owned();