Bugzilla – Attachment 104894 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: Crash with the original error if API spec are invalid
Bug-25504-Crash-with-the-original-error-if-API-spe.patch (text/plain), 1.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-05-14 18:17:20 UTC
(
hide
)
Description:
Bug 25504: Crash with the original error if API spec are invalid
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-05-14 18:17:20 UTC
Size:
1.86 KB
patch
obsolete
>From f8ce022d6cf536ddf8ab4868bded5647832e3163 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 14 May 2020 15:34:41 +0200 >Subject: [PATCH] Bug 25504: Crash with the original error if API spec are > invalid > >Bug 24700 put the whole spec validation into a try catch block that >hides the original error raised by the JSON validator. > >If you don't have the patches from bug 25482 and start plack under D10 >you will see a huge stacktrace with, lost in the middle: > Koha::REST::V1::catch {...} ("Duplicate keys not allowed, at character offset 4789 (before "...) called at /usr/share/perl5/Try/Tiny.pm line 123 >The complete output is at bug 25482 comment 11. > >With this patch, you will get a single line: >Error while loading /etc/koha/sites/kohadev/plack.psgi: Can't load application from file "/kohadevbox/koha/api/v1/app.pl": Duplicate keys not allowed, at character offset 4789 (before "editcatalogue": "cre...") at /usr/share/perl5/Mojo/JSON.pm line 39. > >I am all for stacktraces, but not if the error is hidden ;) > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1.pm | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index 680b52cd670..b86104e61dc 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -74,15 +74,14 @@ sub startup { > push @{$self->routes->namespaces}, 'Koha::Plugin'; > > # Try to load and merge all schemas first and validate the result just once. >- my $spec; >- try { >- $spec = $validator->bundle( >+ my $spec = $validator->bundle( > { > replace => 1, > schema => $self->home->rel_file("api/v1/swagger/swagger.json") > } > ); > >+ try { > $self->plugin( > 'Koha::REST::Plugin::PluginRoutes' => { > spec => $spec, >-- >2.26.2
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