From f8d35ef0bfc812494f7d30dff1d075a3327209f1 Mon Sep 17 00:00:00 2001 From: minhee <alsdldlfrl@gmail.com> Date: 금, 11 2월 2022 18:30:04 +0900 Subject: [PATCH] - 사용자 정의 필드 필드 유형 변경시 기본값 항목 표시 오류 수정 폼에도 적용 - 입력 폼에서 탭키 안먹는 현상 수정 --- src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java b/src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java index 20fc132..e7d3346 100644 --- a/src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java +++ b/src/main/java/kr/wisestone/owl/web/resolver/OwlResponseEntityExceptionHandler.java @@ -3,6 +3,8 @@ import kr.wisestone.owl.common.MessageAccessor; import kr.wisestone.owl.constant.Constants; import kr.wisestone.owl.constant.MsgConstants; +import kr.wisestone.owl.exception.ApiAuthException; +import kr.wisestone.owl.exception.ApiParameterException; import kr.wisestone.owl.exception.OwlRuntimeException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,12 +36,28 @@ super(); } + @ExceptionHandler({ApiParameterException.class }) + public ResponseEntity<Object> handleBadRequest(final ApiParameterException ex, final WebRequest request) { + Map<String, Object> resJsonData = new HashMap<String, Object>(); + resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(ex, Constants.RES_KEY_MSG_FAIL)); + + return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); + } + + @ExceptionHandler({ApiAuthException.class }) + public ResponseEntity<Object> handleBadRequest(final ApiAuthException ex, final WebRequest request) { + Map<String, Object> resJsonData = new HashMap<String, Object>(); + resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(ex, Constants.RES_KEY_MSG_FAIL)); + + return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.UNAUTHORIZED, request); + } + @ExceptionHandler({OwlRuntimeException.class }) public ResponseEntity<Object> handleBadRequest(final OwlRuntimeException ex, final WebRequest request) { Map<String, Object> resJsonData = new HashMap<String, Object>(); resJsonData.put(Constants.RES_KEY_MESSAGE, this.messageAccessor.getResMessage(ex, Constants.RES_KEY_MSG_FAIL)); - return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); + return this.handleExceptionInternal(ex, resJsonData, new HttpHeaders(), HttpStatus.OK, request); } @ExceptionHandler({ StackOverflowError.class, @@ -75,7 +93,7 @@ final MethodArgumentNotValidException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) { final String bodyOfResponse = "This should be application specific4"; - return this.handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.OK, request); + return this.handleExceptionInternal(ex, bodyOfResponse, headers, HttpStatus.BAD_REQUEST, request); } @Override -- Gitblit v1.8.0