diff --git a/src/main/java/com/postech30/hackathon/exceptions/CustomExceptionHandler.java b/src/main/java/com/postech30/hackathon/exceptions/CustomExceptionHandler.java index 24945a3..99e6cf4 100644 --- a/src/main/java/com/postech30/hackathon/exceptions/CustomExceptionHandler.java +++ b/src/main/java/com/postech30/hackathon/exceptions/CustomExceptionHandler.java @@ -66,5 +66,17 @@ protected ResponseEntity badRequest(BadRequestException e, HttpServletRe body.put("path", request.getRequestURI()); return new ResponseEntity<>(body, status); } + @ExceptionHandler(RoomNotAvailableException.class) + protected ResponseEntity badRequest(RoomNotAvailableException e, HttpServletRequest request) { + HttpStatus status = HttpStatus.BAD_REQUEST; + + Map body = new HashMap<>(); + body.put("timestamp", Instant.now()); + body.put("status", status.value()); + body.put("error", e.getMessage()); + body.put("path", request.getRequestURI()); + return new ResponseEntity<>(body, status); + } + }