[Bug 27806] New: Exceptions thrown during a call to ->render are not caught and passed to ->unhandled_exception
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27806 Bug ID: 27806 Summary: Exceptions thrown during a call to ->render are not caught and passed to ->unhandled_exception Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@ptfs-europe.com Depends on: 27680 Whilst working on 27680 I discovered that we do not catch exceptions that are thrown at the point of render. I failed to resolve the problem there so have moved this piece to it's own bug. The tests added catch the 500 responses and those responses are the HTML rendered Mojo::Exception templates.. I'll attach the patches I came up with that are not working as expected :(. I've also tried using $self->helper( 'reply.exception' => sub { my ($page, $c, $e) = @_; # Custom error page handling here } ); and $self->before_render => sub { my ($c, $args) = @_; # Make sure we are rendering the exception template return unless my $template = $args->{template}; return unless $template eq 'exception'; # Switch to JSON rendering if content negotiation allows it return unless $c->accepts('json'); $args->{json} = {exception => $c->stash('exception')}; }; and neither appeared to work :( Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27680 [Bug 27680] API DataTables Wrapper fails for ordering on multi-data-field columns -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27806 --- Comment #1 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 117376 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117376&action=edit Bug 27806: (follow-up) Add Koha::Exception for bad queries This patch adds a PropertyNotFound exception tothe 'as_list' method to catch DBIx::Class excpetions caused by passing bad column names into a query. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27806 --- Comment #2 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 117377 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117377&action=edit Bug 27806: (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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27806 Bug 27806 depends on bug 27680, which changed state. Bug 27680 Summary: API DataTables Wrapper fails for ordering on multi-data-field columns https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27680 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27806 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com | |, tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org