|
@@ -7,6 +7,7 @@ package com.ym.filter;
|
|
|
import com.ym.common.ApiException;
|
|
|
import com.ym.common.BaseResponse;
|
|
|
import com.ym.common.ErrorEnum;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.ConversionNotSupportedException;
|
|
|
import org.springframework.beans.TypeMismatchException;
|
|
@@ -88,6 +89,13 @@ public class GlobalExceptionHandlerAdvice {
|
|
|
return getResponseData(ex);
|
|
|
}
|
|
|
|
|
|
+ @ResponseStatus(value = HttpStatus.OK)
|
|
|
+ @ExceptionHandler(BizException.class)
|
|
|
+ public BaseResponse<Object> handleBizException(BizException ex) {
|
|
|
+ logException(ex);
|
|
|
+ return new BaseResponse<>(ex.getCode(), ex.getMessage(), "");
|
|
|
+ }
|
|
|
+
|
|
|
private void logException(Exception ex) {
|
|
|
log.error("caught exception:", ex);
|
|
|
}
|