bổ sung thêm chức năng
This commit is contained in:
@@ -27,4 +27,22 @@ public class GlobalExceptionHandler {
|
||||
public Map<String, String> handleNotFound(UserNotFoundException ex) {
|
||||
return Map.of("message", ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(GiftCodeReservationException.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public Map<String, String> handleGiftCodeReservation(GiftCodeReservationException ex) {
|
||||
return Map.of("message", ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(LocalProcessingException.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public Map<String, String> handleLocalProcessing(LocalProcessingException ex) {
|
||||
return Map.of("message", ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public Map<String, String> handleRuntimeException(RuntimeException ex) {
|
||||
return Map.of("message", "An unexpected error occurred: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user