|
|
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.web.reactive.function.BodyInserters;
|
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
|
+import org.springframework.web.reactive.function.client.WebClientRequestException;
|
|
|
import org.springframework.web.reactive.function.client.WebClientResponseException;
|
|
|
import reactor.core.publisher.Flux;
|
|
|
import reactor.core.publisher.Mono;
|
|
|
@@ -299,6 +300,15 @@ public class RequestComponent {
|
|
|
null
|
|
|
)
|
|
|
)
|
|
|
+ .onErrorMap(WebClientRequestException.class, ex ->
|
|
|
+ new WebClientResponseException(
|
|
|
+ 502,
|
|
|
+ "第三方接口请求失败(DNS解析失败或连接异常):" + url + ",原因:" + ex.getMessage(),
|
|
|
+ HttpHeaders.EMPTY,
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ )
|
|
|
+ )
|
|
|
.block();
|
|
|
}
|
|
|
|
|
|
@@ -418,6 +428,15 @@ public class RequestComponent {
|
|
|
null
|
|
|
)
|
|
|
)
|
|
|
+ .onErrorMap(WebClientRequestException.class, ex ->
|
|
|
+ new WebClientResponseException(
|
|
|
+ 502,
|
|
|
+ "第三方接口请求失败(DNS解析失败或连接异常):" + url + ",原因:" + ex.getMessage(),
|
|
|
+ HttpHeaders.EMPTY,
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ )
|
|
|
+ )
|
|
|
.block();
|
|
|
if (rawResponse == null) {
|
|
|
throw new WebClientResponseException(
|