Bugzilla – Attachment 117375 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.79 KB, created by
Martin Renvoize (ashimema)
on 2021-02-26 12:30:44 UTC
(
hide
)
Description:
Bug 27680: (follow-up) Attempt to catch the exception
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-26 12:30:44 UTC
Size:
1.79 KB
patch
obsolete
>From 06e7ab4560428e8f45e587b0d138aadcb4db2326 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/Exceptions.pm | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/Plugin/Exceptions.pm b/Koha/REST/Plugin/Exceptions.pm >index e9be043aa2..e56f2b28ea 100644 >--- a/Koha/REST/Plugin/Exceptions.pm >+++ b/Koha/REST/Plugin/Exceptions.pm >@@ -54,16 +54,21 @@ sub register { > $app->helper( > 'unhandled_exception' => sub { > my ( $c, $exception ) = @_; >+ warn "Inside unhandled_exception\n"; > >- my $req = $c->req; >- my $method = $req->method; >- my $path = $req->url->to_abs->path; > my $type = ""; >- > if ( blessed $exception ) { >- $type = "(" . ref($exception) . ")"; >+ if ( $exception->isa('Koha::Exceptions::Object::PropertyNotFound') ) { >+ $c->render( status => 400, json => $_->error ); >+ } else { >+ $type = "(" . ref($exception) . ")"; >+ } > } > >+ my $req = $c->req; >+ my $method = $req->method; >+ my $path = $req->url->to_abs->path; >+ > my $exception_string = "$exception"; > chomp($exception_string); > >-- >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