View | Details | Raw Unified | Return to bug 27330
Collapse All | Expand All

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

Return to bug 27330