Bugzilla – Attachment 127608 Details for
Bug 27145
Patron deletion via intranet doesn't handle exceptions well
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27145: Rethrow all other exceptions
Bug-27145-Rethrow-all-other-exceptions.patch (text/plain), 1.78 KB, created by
Joonas Kylmälä
on 2021-11-13 14:17:10 UTC
(
hide
)
Description:
Bug 27145: Rethrow all other exceptions
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-11-13 14:17:10 UTC
Size:
1.78 KB
patch
obsolete
>From 5263a2ee7472941dd8244085ed37410d4b372b8e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 3 Dec 2020 09:10:30 -0500 >Subject: [PATCH] Bug 27145: Rethrow all other exceptions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Bug 14708 introduced a try catch around $patron->delete in commit: > "Bug 14708: (QA follow-up) Use try/catch blocks when calling" > >However, in the catch block it only assumes the exception was from trying to >delete anonymous patron when it can be anything else as well, the code should >be modified so that it will handle the anonymous patron case and if it is >anything else we log the other exception. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >--- > members/deletemem.pl | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/members/deletemem.pl b/members/deletemem.pl >index 02e3714c75..4b31e1d76a 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -132,8 +132,14 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) { > try { > $patron->delete; > print $input->redirect("/cgi-bin/koha/members/members-home.pl"); >- } catch { >- print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON"); >+ } >+ catch { >+ if ( $_->isa('Koha::Exceptions::Patron::FailedDeleteAnonymousPatron') ) { >+ print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON"); >+ } >+ else { >+ $_->rethrow; >+ } > }; > # TODO Tell the user everything went ok > exit 0; # Exit without error >-- >2.20.1
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 27145
:
114149
|
114183
|
127545
|
127546
| 127608 |
127609