Skip to content

Commit 0631085

Browse files
update exceptionAdvice
1 parent 638c794 commit 0631085

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

syncer-webapp/src/main/java/syncer/syncerpluswebapp/advice/ExceptionAdvice.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public ResultMap ConnectException(ConnectException e){
7171
*/
7272
@ExceptionHandler(ConstraintViolationException.class)
7373
public ResultMap ConstraintViolationException(ConstraintViolationException e){
74+
log.warn(e.getMessage());
7475
List<ConstraintViolation> errorInformation = new ArrayList<ConstraintViolation>(e.getConstraintViolations());
7576
return ResultMap.builder().code(CodeConstant.VALITOR_ERROR_CODE)
7677
.msg(errorInformation.get(0).getMessage());
@@ -83,6 +84,7 @@ public ResultMap ConstraintViolationException(ConstraintViolationException e){
8384
*/
8485
@ExceptionHandler(BindException.class)
8586
public ResultMap BindException(BindException e){
87+
log.warn(e.getMessage());
8688
List<String> errorInformation = e.getBindingResult().getAllErrors()
8789
.stream()
8890
.map(ObjectError::getDefaultMessage)
@@ -100,6 +102,7 @@ public ResultMap BindException(BindException e){
100102
*/
101103
@ExceptionHandler(MethodArgumentNotValidException.class)
102104
public ResultMap MethodArgumentNotValidException(MethodArgumentNotValidException e){
105+
log.warn(e.getMessage());
103106
String msg = msgConvertor(((MethodArgumentNotValidException) e).getBindingResult());
104107
return ResultMap.builder().code(CodeConstant.VALITOR_ERROR_CODE)
105108
.msg(msg);
@@ -165,7 +168,8 @@ public ResultMap TaskMsgException(TaskMsgException e){
165168
* @return
166169
*/
167170
@ExceptionHandler(HttpMessageNotReadableException.class)
168-
public ResultMap HttpMessageNotReadableException(){
171+
public ResultMap HttpMessageNotReadableException(HttpMessageNotReadableException e){
172+
log.warn(e.getMessage());
169173
return ResultMap.builder().code(CodeConstant.HTTP_MSG_PARSE_ERROR_CODE)
170174
.msg(HttpMsgConstant.HTTP_MSG_PARSE_ERROR_CODE);
171175
}
@@ -175,7 +179,8 @@ public ResultMap HttpMessageNotReadableException(){
175179
* @return
176180
*/
177181
@ExceptionHandler(Exception.class)
178-
public ResultMap Exception(){
182+
public ResultMap Exception(Exception e){
183+
log.warn(e.getMessage());
179184
return ResultMap.builder().code(CodeConstant.HTTP_ERROR_CODE)
180185
.msg(HttpMsgConstant.HTTP_ERROR_MESSAGE);
181186
}

0 commit comments

Comments
 (0)