We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55a2797 commit 795a778Copy full SHA for 795a778
src/main/java/roomescape/reservation/presentation/ReservationController.java
@@ -32,10 +32,8 @@ public ResponseEntity<Reservation> createReservation(@Valid @RequestBody Reserva
32
33
@DeleteMapping("/reservations/{reservationId}")
34
public ResponseEntity<Void> deleteReservation(@PathVariable Long reservationId) {
35
- Optional<Reservation> deleteReservation = reservationService.deleteReservation(reservationId);
36
- if (deleteReservation.isEmpty()) {
37
- throw new NotFoundReservationException();
38
- }
+ Reservation deletedReservation = reservationService.deleteReservation(reservationId)
+ .orElseThrow(NotFoundReservationException::new);
39
40
return ResponseEntity.noContent().build();
41
}
0 commit comments