Bugzilla – Attachment 102974 Details for
Bug 25032
Generic unhandled exception handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25032: Chomp stringified exception
Bug-25032-Chomp-stringified-exception.patch (text/plain), 1.53 KB, created by
Jonathan Druart
on 2020-04-15 09:17:13 UTC
(
hide
)
Description:
Bug 25032: Chomp stringified exception
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-15 09:17:13 UTC
Size:
1.53 KB
patch
obsolete
>From 319ac570cb2e88f7aa43f20067ead3e5c83c4820 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 14 Apr 2020 17:50:58 -0300 >Subject: [PATCH] Bug 25032: Chomp stringified exception > >If we catch a Koha::Exception-derived exception, the log is put in a >single line. If the code 'dies' then a newline character is appended to >the string. This patch chomps it so it displays in a single line. > >To test: >1. Tweak Koha::REST::V1::Cities::list in the try block so it dies before > render >2. Restart plack and try the original test plan >=> FAIL: Notice two lines are logged >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Only one line in the logs >5. Verify rendering a Koha::Exception works as well: > Koha::Exceptions::Exception->throw("Nada!"); > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/REST/Plugin/Exceptions.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/Plugin/Exceptions.pm b/Koha/REST/Plugin/Exceptions.pm >index 4539b847aa..9e5c5e5727 100644 >--- a/Koha/REST/Plugin/Exceptions.pm >+++ b/Koha/REST/Plugin/Exceptions.pm >@@ -64,7 +64,10 @@ sub register { > $type = "(" . ref($exception) . ")"; > } > >- my $message = "$method $path: unhandled exception $type\<\<$exception\>\>"; >+ my $exception_string = "$exception"; >+ chomp($exception_string); >+ >+ my $message = "$method $path: unhandled exception $type\<\<$exception_string\>\>"; > > $c->app->log->error("$message"); > >-- >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 25032
:
102160
|
102161
|
102305
|
102306
|
102307
|
102523
|
102524
|
102525
|
102947
|
102971
|
102972
|
102973
|
102974
|
102975
|
103752
|
103753
|
103754
|
103755
|
103756