Bugzilla – Attachment 61073 Details for
Bug 18206
REST API: Default exception handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18206: Use this feature for cities
Bug-18206-Use-this-feature-for-cities.patch (text/plain), 2.79 KB, created by
Lari Taskula
on 2017-03-14 16:22:49 UTC
(
hide
)
Description:
Bug 18206: Use this feature for cities
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-03-14 16:22:49 UTC
Size:
2.79 KB
patch
obsolete
>From ddc99cbb82d80792053cf4fd4f85a8d1a57a9d6d Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Tue, 14 Mar 2017 18:19:58 +0200 >Subject: [PATCH] Bug 18206: Use this feature for cities > >To test: >1. prove t/db_dependent/api/v1/cities.t >--- > Koha/REST/V1/Cities.pm | 37 +++++-------------------------------- > 1 file changed, 5 insertions(+), 32 deletions(-) > >diff --git a/Koha/REST/V1/Cities.pm b/Koha/REST/V1/Cities.pm >index 3003e3a..a1a13b4 100644 >--- a/Koha/REST/V1/Cities.pm >+++ b/Koha/REST/V1/Cities.pm >@@ -21,6 +21,7 @@ use Mojo::Base 'Mojolicious::Controller'; > > use Koha::City; > use Koha::Cities; >+use Koha::Exceptions; > > use Try::Tiny; > >@@ -40,14 +41,7 @@ sub list { > return $c->render( status => 200, openapi => $cities ); > } > catch { >- if ( $_->isa('DBIx::Class::Exception') ) { >- return $c->render( status => 500, >- openapi => { error => $_->{msg} } ); >- } >- else { >- return $c->render( status => 500, >- openapi => { error => "Something went wrong, check the logs."} ); >- } >+ Koha::Exceptions::rethrow_exception($_); > }; > > } >@@ -74,14 +68,7 @@ sub add { > return $c->render( status => 200, openapi => $city ); > } > catch { >- if ( $_->isa('DBIx::Class::Exception') ) { >- return $c->render( status => 500, >- openapi => { error => $_->{msg} } ); >- } >- else { >- return $c->render( status => 500, >- openapi => { error => "Something went wrong, check the logs."} ); >- } >+ Koha::Exceptions::rethrow_exception($_); > }; > } > >@@ -102,14 +89,7 @@ sub update { > return $c->render( status => 404, > openapi => { error => "Object not found" } ); > } >- elsif ( $_->isa('Koha::Exceptions::Object') ) { >- return $c->render( status => 500, >- openapi => { error => $_->message } ); >- } >- else { >- return $c->render( status => 500, >- openapi => { error => "Something went wrong, check the logs."} ); >- } >+ Koha::Exceptions::rethrow_exception($_); > }; > > } >@@ -129,14 +109,7 @@ sub delete { > return $c->render( status => 404, > openapi => { error => "Object not found" } ); > } >- elsif ( $_->isa('DBIx::Class::Exception') ) { >- return $c->render( status => 500, >- openapi => { error => $_->{msg} } ); >- } >- else { >- return $c->render( status => 500, >- openapi => { error => "Something went wrong, check the logs."} ); >- } >+ Koha::Exceptions::rethrow_exception($_); > }; > > } >-- >1.9.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 18206
:
61072
|
61073
|
61087
|
61088
|
61170
|
61171
|
68243
|
69229
|
69230
|
69231
|
85715
|
85716
|
85717