Bugzilla – Attachment 109234 Details for
Bug 25504
Wrong API spec breaks plack without meaningful error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25504: Use Koha::Logger and display the full stacktrace
Bug-25504-Use-KohaLogger-and-display-the-full-stac.patch (text/plain), 2.19 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-08-27 14:37:10 UTC
(
hide
)
Description:
Bug 25504: Use Koha::Logger and display the full stacktrace
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-08-27 14:37:10 UTC
Size:
2.19 KB
patch
obsolete
>From ca855d0bb59ebc8054fe78c4d0836ef19fc5e132 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 27 Aug 2020 15:26:05 +0200 >Subject: [PATCH] Bug 25504: Use Koha::Logger and display the full stacktrace > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/Plugin/PluginRoutes.pm | 4 +++- > Koha/REST/V1.pm | 6 ++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/Plugin/PluginRoutes.pm b/Koha/REST/Plugin/PluginRoutes.pm >index 87bd2a6030..d434ee537d 100644 >--- a/Koha/REST/Plugin/PluginRoutes.pm >+++ b/Koha/REST/Plugin/PluginRoutes.pm >@@ -21,6 +21,7 @@ use Mojo::Base 'Mojolicious::Plugin'; > > use Koha::Exceptions::Plugin; > use Koha::Plugins; >+use Koha::Logger; > > use Clone qw(clone); > use Try::Tiny; >@@ -91,7 +92,8 @@ sub inject_routes { > catch { > my $error = $_; > my $class = ref $plugin; >- warn "Plugin $class route injection failed: $error"; >+ my $logger = Koha::Logger->get({ interface => 'api' }); >+ $logger->error("Plugin $class route injection failed: $error"); > return $spec; > }; > } >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index c490b6c3fe..8942c30c2e 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -20,6 +20,7 @@ use Modern::Perl; > use Mojo::Base 'Mojolicious'; > > use C4::Context; >+use Koha::Logger; > use Carp; > use JSON::Validator::OpenAPI::Mojolicious; > use Try::Tiny; >@@ -106,7 +107,8 @@ sub startup { > # to catch bad ones. > > # JSON::Validator uses confess, so trim call stack from the message. >- carp "Warning: Could not load REST API spec bundle: " . ($_ =~ /\A(.*?)$/ms)[0]; >+ my $logger = Koha::Logger->get({ interface => 'api' }); >+ $logger->error("Warning: Could not load REST API spec bundle: " . $_); > > try { > $validator->load_and_validate_schema( >@@ -138,7 +140,7 @@ sub startup { > } > catch { > # JSON::Validator uses confess, so trim call stack from the message. >- croak "Could not load REST API spec: " . ($_ =~ /\A(.*?)$/ms)[0]; >+ $logger->error("Warning: Could not load REST API spec bundle: " . $_); > }; > }; > >-- >2.28.0
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 25504
:
104884
|
104894
|
106011
|
109227
|
109228
|
109233
| 109234 |
109235
|
109420