Lines 128-146
sub add {
Link Here
|
128 |
} |
128 |
} |
129 |
catch { |
129 |
catch { |
130 |
if ( blessed $_ ) { |
130 |
if ( blessed $_ ) { |
131 |
if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) { |
131 |
if ($_->isa('Koha::Exceptions::ClubHold::NoPatrons')) { |
132 |
my $broken_fk = $_->broken_fk; |
|
|
133 |
|
134 |
if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Clubs::Holds::to_api_mapping} ) { |
135 |
$c->render( |
136 |
status => 404, |
137 |
openapi => $Koha::REST::V1::Clubs::Holds::to_api_mapping->{$broken_fk} . ' not found.' |
138 |
); |
139 |
} |
140 |
} |
141 |
elsif ($_->isa('Koha::Exceptions::ClubHold')) { |
142 |
return $c->render( |
132 |
return $c->render( |
143 |
status => 500, |
133 |
status => 403, |
144 |
openapi => { error => $_->description } |
134 |
openapi => { error => $_->description } |
145 |
); |
135 |
); |
146 |
} |
136 |
} |
147 |
- |
|
|