Bug 36307: SMS::Send driver errors are not captured and stored
If an SMS::Send driver succeeds, it returns a value that evaluates to true. Every driver I've inspected uses croak when it encounters a failure state.
When an SMS message fails to send, code hard codes the failure code to NO_NOTES (No notes from SMS driver).
We should store the real error in `failure_code` and display that if the failure code doesn't match a known failure code.
Test Plan:
1) Apply this patch
2) Set SMSSendDriver to any value
3) Generate a pending sms message
4) Run the following query:
update message_queue set status = 'failed', failure_code = "This is a test";
5) View the patron's messages, note the delivery note contains the
contents of the failure code
6) Run the following query:
update message_queue set status = 'failed', failure_code = "SMS_SEND_DRIVER_MISSING";
7) Reload the patron's messages, not the delivery note is now "The SMS
driver could not be loaded".
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit
8acdc1e8e9b88436204f6d16c9d5abbc775d8943)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>