|
@@ -2,8 +2,10 @@ package com.jkcredit.invoice.hub.config;
|
|
|
|
|
|
import com.jkcredit.invoice.hub.constant.CommonConstant;
|
|
|
import com.jkcredit.invoice.hub.constant.ResponseStatus;
|
|
|
+import com.jkcredit.invoice.hub.enums.ApiResponseCodeEnum;
|
|
|
import com.jkcredit.invoice.hub.model.vo.common.AppResponseVo;
|
|
|
import com.jkcredit.invoice.hub.spi.lang.exception.ServiceException;
|
|
|
+import com.jkcredit.invoice.hub.spi.rest.data.ApiResponseData;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -24,8 +26,9 @@ import java.util.Collections;
|
|
|
public class ControllerAdvice {
|
|
|
|
|
|
@ExceptionHandler(value = Exception.class)
|
|
|
- public ResponseEntity<AppResponseVo> errorHandler(ServiceException ex) {
|
|
|
- return ResponseEntity.ok(new AppResponseVo(ResponseStatus.FAILED, ex.getMessage(), null));
|
|
|
+ public ApiResponseData errorHandler(Exception ex) {
|
|
|
+ log.error("全局处理异常,失败原因:{}", ex.getMessage());
|
|
|
+ return ApiResponseData.failure(ApiResponseCodeEnum.CODE_9998.getValue(), ApiResponseCodeEnum.CODE_9998.getDesc());
|
|
|
}
|
|
|
|
|
|
}
|