|
Lines 83-89
sub add {
Link Here
|
| 83 |
$c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); |
83 |
$c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); |
| 84 |
return $c->render( |
84 |
return $c->render( |
| 85 |
status => 201, |
85 |
status => 201, |
| 86 |
openapi => $c->objects->to_api( $booking ), |
86 |
openapi => $c->objects->to_api($booking), |
| 87 |
); |
87 |
); |
| 88 |
} catch { |
88 |
} catch { |
| 89 |
if ( blessed $_ and $_->isa('Koha::Exceptions::Booking::Clash') ) { |
89 |
if ( blessed $_ and $_->isa('Koha::Exceptions::Booking::Clash') ) { |
|
Lines 91-96
sub add {
Link Here
|
| 91 |
status => 400, |
91 |
status => 400, |
| 92 |
openapi => { error => "Booking would conflict" } |
92 |
openapi => { error => "Booking would conflict" } |
| 93 |
); |
93 |
); |
|
|
94 |
} elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) { |
| 95 |
return $c->render( |
| 96 |
status => 400, |
| 97 |
openapi => { |
| 98 |
error => "Duplicate booking_id", |
| 99 |
} |
| 100 |
); |
| 94 |
} |
101 |
} |
| 95 |
|
102 |
|
| 96 |
return $c->unhandled_exception($_); |
103 |
return $c->unhandled_exception($_); |