|
|
@@ -6,6 +6,7 @@ import com.mrxu.framework.boot.web.ServletUtils;
|
|
|
import com.mrxu.framework.common.util.BaseCode;
|
|
|
import com.mrxu.framework.common.util.BusinessException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
|
|
@@ -26,6 +27,10 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
@Slf4j
|
|
|
public class FeignProviderExceptionHandler {
|
|
|
|
|
|
+ // 当前服务名称
|
|
|
+ @Value("${spring.application.name:未知(未配置spring.application.name)}")
|
|
|
+ private String serviceName;
|
|
|
+
|
|
|
/*@Retention(RetentionPolicy.RUNTIME)
|
|
|
@Target({ElementType.TYPE})
|
|
|
@Documented
|
|
|
@@ -57,7 +62,7 @@ public class FeignProviderExceptionHandler {
|
|
|
|
|
|
public Object rendError(boolean isBusinessException,BaseCode code, Throwable cause) {
|
|
|
HttpServletRequest request = ServletUtils.getRequest();
|
|
|
- FeignProviderException exception = new FeignProviderException(isBusinessException,code,cause);
|
|
|
+ FeignProviderException exception = new FeignProviderException(isBusinessException,serviceName,code,cause);
|
|
|
return exception;
|
|
|
}
|
|
|
|