Bugzilla – Attachment 117341 Details for
Bug 27680
API DataTables Wrapper fails for ordering on multi-data-field columns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27680: (follow-up) Attempt to catch the exception
Bug-27680-follow-up-Attempt-to-catch-the-exception.patch (text/plain), 1.43 KB, created by
Martin Renvoize (ashimema)
on 2021-02-25 15:25:10 UTC
(
hide
)
Description:
Bug 27680: (follow-up) Attempt to catch the exception
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-25 15:25:10 UTC
Size:
1.43 KB
patch
obsolete
>From 0e076e110840abc159dc718c18276eef726436dc Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 25 Feb 2021 15:22:35 +0000 >Subject: [PATCH] Bug 27680: (follow-up) Attempt to catch the exception > >Help: I'm struggling to catch the point at which the exception should be >thrown to convert it to a 400 error response in the API. '->search' does >not actually trigger the DB hit until we reference some data from it.. >so we can't use that.. so I tried '->count', but of course.. that drops >'order_by' which is the failure in this case and so we pass through. >--- > Koha/REST/Plugin/Objects.pm | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index 246aece704..50168d79b1 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -18,6 +18,7 @@ package Koha::REST::Plugin::Objects; > use Modern::Perl; > > use Mojo::Base 'Mojolicious::Plugin'; >+use Try::Tiny; > > use JSON; > >@@ -114,7 +115,11 @@ sub register { > } > # Perform search > my $objects = $result_set->search( $filtered_params, $attributes ); >- my $total = $result_set->search->count; >+ my $total = try { >+ $result_set->search->count; >+ } catch { >+ warn "Caught in REST Plugin\n"; >+ }; > > $c->add_pagination_headers( > { >-- >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 27680
:
116794
|
116795
|
116796
|
116829
|
116831
|
116832
|
116833
|
116834
|
116843
|
116844
|
116845
|
116846
|
117335
|
117336
|
117337
|
117338
|
117339
|
117340
|
117341
|
117375
|
117388
|
117389
|
117390
|
117391
|
117392
|
117393
|
117394
|
117438
|
117439
|
117440
|
117441
|
117442
|
117476