|
|
|
@ -72,7 +72,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
protected ResponseEntity<Object> handleMethodArgumentNotValid(
|
|
|
|
|
MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status,
|
|
|
|
|
WebRequest request) {
|
|
|
|
|
log.error("==== MethodArgumentNotValidException override ====");
|
|
|
|
|
log.error("==== MethodArgumentNotValidException override ====\n{}", ex.getMessage());
|
|
|
|
|
Map<String, String> validErrorMap = new HashMap<>();
|
|
|
|
|
ex.getBindingResult().getFieldErrors()
|
|
|
|
|
.forEach(e -> validErrorMap.put(e.getField(), e.getDefaultMessage()));
|
|
|
|
@ -96,7 +96,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
protected ResponseEntity<Object> handleHttpMessageNotReadable(
|
|
|
|
|
HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatus status,
|
|
|
|
|
WebRequest request) {
|
|
|
|
|
log.error("==== HttpMessageNotReadableException override ====");
|
|
|
|
|
log.error("==== HttpMessageNotReadableException override ====\n{}", ex.getMessage());
|
|
|
|
|
|
|
|
|
|
return ResponseEntity
|
|
|
|
|
.ok()
|
|
|
|
@ -112,7 +112,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
*/
|
|
|
|
|
@ExceptionHandler(value = {BizRuntimeException.class})
|
|
|
|
|
protected ApiResponseDTO handleBizRutimeException(BizRuntimeException e) {
|
|
|
|
|
log.error("==== throw BizRutimeException====");
|
|
|
|
|
log.error("==== throw BizRutimeException====\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -125,7 +125,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {EgovBizException.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
|
|
|
|
protected ApiResponseDTO handleEgovBizException(EgovBizException e) {
|
|
|
|
|
log.error("==== throw EgovBizException ====================");
|
|
|
|
|
log.error("==== throw EgovBizException ====================\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {NoSuchElementException.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
|
|
|
|
protected ApiResponseDTO handleNoSuchElementException(NoSuchElementException e) {
|
|
|
|
|
log.error("==== throw NoSuchElementException ====================");
|
|
|
|
|
log.error("==== throw NoSuchElementException ====================\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -149,7 +149,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {IllegalArgumentException.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
|
|
|
|
protected ApiResponseDTO handleIllegalArgumentException(IllegalArgumentException e) {
|
|
|
|
|
log.error("==== throw IllegalArgumentException ====================");
|
|
|
|
|
log.error("==== throw IllegalArgumentException ====================\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -172,7 +172,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {CompletionException.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
|
|
|
|
protected ApiResponseDTO handleCompletionException(CompletionException e) {
|
|
|
|
|
log.error("==== throw CompletionException ====================");
|
|
|
|
|
log.error("==== throw CompletionException ====================\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -185,7 +185,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {RuntimeException.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
|
protected ApiResponseDTO handleRuntimeException(RuntimeException e) {
|
|
|
|
|
log.error("==== throw RuntimeException ====================");
|
|
|
|
|
log.error("==== throw RuntimeException ====================", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -198,7 +198,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
@ExceptionHandler(value = {Exception.class})
|
|
|
|
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
|
|
protected ApiResponseDTO handleException(Exception e) {
|
|
|
|
|
log.error("==== throw Exception ====================");
|
|
|
|
|
log.error("==== throw Exception ====================\n{}", e.getMessage());
|
|
|
|
|
return sendError(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|