ent done-time ISSUE TIME: report parse error instead of panicking

This commit is contained in:
Sebastian Kuzminsky 2025-07-19 21:10:14 -06:00
parent 6a1e438c94
commit 8af9c71ef6

View file

@ -499,9 +499,13 @@ fn handle_command(
let Some(issue) = issues.get_mut_issue(issue_id) else { let Some(issue) = issues.get_mut_issue(issue_id) else {
return Err(anyhow::anyhow!("issue {} not found", issue_id)); return Err(anyhow::anyhow!("issue {} not found", issue_id));
}; };
let done_time = chrono::DateTime::parse_from_rfc3339(done_time) let done_time = match chrono::DateTime::parse_from_rfc3339(done_time) {
.unwrap() Ok(done_time) => done_time.with_timezone(&chrono::Local),
.with_timezone(&chrono::Local); Err(e) => {
eprintln!("failed to parse done-time from {}", done_time);
return Err(e.into());
}
};
issue.set_done_time(done_time)?; issue.set_done_time(done_time)?;
} }
None => match &issue.done_time { None => match &issue.done_time {