|
|
@@ -53,13 +53,11 @@ public class GlobalExceptionHandler {
|
|
|
|
|
|
@ExceptionHandler(NotLoginException.class)
|
|
|
public R handleNotLoginException(NotLoginException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
return R.result(ResultCode.TOKEN_ERROR);
|
|
|
}
|
|
|
|
|
|
@ExceptionHandler(NotRoleException.class)
|
|
|
public R handleNotRoleException(NotRoleException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
return R.result(ResultCode.UN_AUTHORIZED);
|
|
|
}
|
|
|
|
|
|
@@ -71,7 +69,6 @@ public class GlobalExceptionHandler {
|
|
|
|
|
|
@ExceptionHandler(RuntimeException.class)
|
|
|
public R handleRuntimeException(RuntimeException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
// return R.result(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
return R.fail(e.getLocalizedMessage());
|
|
|
}
|
|
|
@@ -120,7 +117,7 @@ public class GlobalExceptionHandler {
|
|
|
*/
|
|
|
@ExceptionHandler(BindException.class)
|
|
|
public R validatedBindException(BindException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
+ log.warn(e.getMessage(), e);
|
|
|
String message = e.getAllErrors().get(0).getDefaultMessage();
|
|
|
return R.fail(message);
|
|
|
}
|
|
|
@@ -130,7 +127,7 @@ public class GlobalExceptionHandler {
|
|
|
*/
|
|
|
@ExceptionHandler(ConstraintViolationException.class)
|
|
|
public R constraintViolationException(ConstraintViolationException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
+ log.warn(e.getMessage(), e);
|
|
|
String message = e.getConstraintViolations().iterator().next().getMessage();
|
|
|
return R.fail(message);
|
|
|
}
|
|
|
@@ -140,7 +137,7 @@ public class GlobalExceptionHandler {
|
|
|
*/
|
|
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
|
|
public Object validExceptionHandler(MethodArgumentNotValidException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
+ log.warn(e.getMessage(), e);
|
|
|
String message = e.getBindingResult().getFieldError().getDefaultMessage();
|
|
|
return R.fail(message);
|
|
|
}
|