@@ -38,6 +38,7 @@ import org.springframework.util.LinkedMultiValueMap
3838import org.springframework.web.reactive.function.BodyInserter
3939import org.springframework.web.reactive.function.BodyInserters
4040import org.springframework.web.reactive.function.client.WebClient
41+ import org.springframework.web.reactive.function.client.WebClientRequestException
4142import org.springframework.web.reactive.function.client.awaitBodyOrNull
4243import org.springframework.web.reactive.function.client.awaitExchangeOrNull
4344import reactor.core.publisher.Flux
@@ -46,6 +47,7 @@ import reactor.netty.http.client.HttpClientRequest
4647import reactor.netty.http.client.HttpClientResponse
4748import java.io.File
4849import java.io.FileInputStream
50+ import java.nio.file.NoSuchFileException
4951
5052@Reflection private val DefaultClientResponseClass = Class .forName(" org.springframework.web.reactive.function.client.DefaultClientResponse" )
5153@Reflection private val DefaultClientResponseFieldResponse = DefaultClientResponseClass .getDeclaredField(" response" ).also { it.isAccessible = true }
@@ -249,7 +251,14 @@ class SpringWebClientTransportClient(networkClientManager: NetworkClientManager)
249251 }
250252 } catch (e: Throwable ) {
251253 log.w(e) { " Encountered error during HTTP call via WebClient" }
252- out .errorMessage = e.message
254+ val errorMessage = if (e is WebClientRequestException && e.cause is NoSuchFileException ) {
255+ " File not found: ${e.cause?.message} "
256+ } else if (e is NoSuchFileException ) {
257+ " File not found: ${e.message} "
258+ } else {
259+ e.message
260+ }
261+ out .errorMessage = errorMessage
253262 out .isError = true
254263 } finally {
255264 out .endAt = KInstant .now()
0 commit comments