From 45c76fa01cbb50925e4254adb02ced415f529895 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 21 Feb 2019 11:08:33 -0500 Subject: [PATCH] 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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( -- 2.11.0