From: Dan Wells Date: Thu, 21 Feb 2019 16:08:33 +0000 (-0500) Subject: LP#1749475 Improve error handling in send_event_email_output X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=45c76fa01cbb50925e4254adb02ced415f529895;p=contrib%2FConifer.git LP#1749475 Improve error handling in send_event_email_output This code was borrowed from a few other places, so it still had the $stat variable, but wasn't doing anything with it. We might as well go a step further and borrow the error handling that variable is there for. Ultimately, email handling should probably moved out to a utility function rather than spread about. Signed-off-by: Dan Wells Signed-off-by: Galen Charlton Signed-off-by: Michele Morgan --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index f2d7d1ac60..aa63e743a8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1880,10 +1880,16 @@ sub send_event_email_output { $stat = $sender->send($email); } catch Error with { $err = $stat = shift; - $logger->error("resend_at_email: Email failed with error: $err"); + $logger->error("send_event_email_output: Email failed with error: $err"); }; - return undef; + if( !$err and $stat and $stat->type eq 'success' ) { + $logger->info("send_event_email_output: successfully sent email"); + return 1; + } else { + $logger->warn("send_event_email_output: unable to send email: ".Dumper($stat)); + return 0; + } } __PACKAGE__->register_method(