Bugzilla – Attachment 31291 Details for
Bug 3186
Invalid or uninstalled SMSSendDriver (or bad number format) causes process_message_queue to fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 3186 - invalid or uninstalled SMSSendDriver (or bad number format) causes process_message_queue to fail
PASSED-QA-Bug-3186---invalid-or-uninstalled-SMSSen.patch (text/plain), 1.92 KB, created by
Kyle M Hall (khall)
on 2014-08-29 14:39:33 UTC
(
hide
)
Description:
[PASSED QA] Bug 3186 - invalid or uninstalled SMSSendDriver (or bad number format) causes process_message_queue to fail
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-08-29 14:39:33 UTC
Size:
1.92 KB
patch
obsolete
>From f1b165ae6b59880a1dcbe6201d14be90ee553741 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Wed, 27 Aug 2014 15:43:59 +0300 >Subject: [PATCH] [PASSED QA] Bug 3186 - invalid or uninstalled SMSSendDriver (or bad number format) causes process_message_queue to fail > >This patch wraps the SMS::Send Driver initialization and sending process into an eval block > and gracefully causes the sending to fail, instead of crashing the process and preventing > emails and good sms' from being sent. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SMS.pm | 19 ++++++++++++++----- > 1 files changed, 14 insertions(+), 5 deletions(-) > >diff --git a/C4/SMS.pm b/C4/SMS.pm >index 24580d6..3a861a7 100644 >--- a/C4/SMS.pm >+++ b/C4/SMS.pm >@@ -75,17 +75,26 @@ sub send_sms { > return unless $driver; > > # warn "using driver: $driver to send message to $params->{'destination'}"; >- >- # Create a sender >- my $sender = SMS::Send->new( $driver, >+ >+ my ($sent, $sender); >+ eval { >+ # Create a sender >+ $sender = SMS::Send->new( $driver, > _login => C4::Context->preference('SMSSendUsername'), > _password => C4::Context->preference('SMSSendPassword'), > ); > >- # Send a message >- my $sent = $sender->send_sms( to => $params->{'destination'}, >+ # Send a message >+ $sent = $sender->send_sms( to => $params->{'destination'}, > text => $params->{'message'}, > ); >+ }; >+ #We might die because SMS::Send $driver is not defined or the sms-number has a bad format >+ #Catch those errors and fail the sms-sending gracefully. >+ if ($@) { >+ warn $@; >+ return undef; >+ } > # warn 'failure' unless $sent; > return $sent; > } >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3186
:
31191
|
31192
|
31216
|
31290
| 31291 |
31292