Skip to content

Commit

Permalink
no need to fail all delivery mechanisms just cause one is unhappy
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikAugust committed Jul 8, 2024
1 parent 0b8c1bd commit c1aff19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/chat/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub async fn generate_brief_summary_of_pull_requests(client: ChatGPT, pull_reque
Here is the content which you should summarise:".to_string();

for pull_request in pull_requests {
let title = pull_request.clone().title.clone().expect("Title should be set on the pull request");
let title = pull_request.clone().title.clone().unwrap_or("No title provided".to_string());
let body = pull_request.clone().body.unwrap_or("No body provided".to_string());
let url = pull_request.clone().html_url.unwrap_or(Url::parse("https://github.com").unwrap());

Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ async fn main() -> Result<()> {
info!("Delivering message using: {}", delivery_mechanism.get_name());

if delivery_mechanism.is_enabled() {
delivery_mechanism.deliver(&date_time, &chat_response).await?;
match delivery_mechanism.deliver(&date_time, &chat_response).await {
Ok(_) => info!("Message delivered successfully by {}", delivery_mechanism.get_name()),
Err(e) => info!("Failed to deliver message: {:?}", e)
}
} else {
info!("Delivery mechanism {} is disabled", delivery_mechanism.get_name());
}
Expand Down

0 comments on commit c1aff19

Please sign in to comment.