@@ -, +, @@ --- Koha/REST/Plugin/Exceptions.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/Koha/REST/Plugin/Exceptions.pm +++ a/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); --