Class WebClientExceptionErrorResolver
java.lang.Object
com.broadleafcommerce.dataexchange.service.error.WebClientHttpRequestAwareErrorResolver
com.broadleafcommerce.dataexchange.service.error.WebClientExceptionErrorResolver
- All Implemented Interfaces:
ErrorResolver
@Order(2147483547)
public class WebClientExceptionErrorResolver
extends WebClientHttpRequestAwareErrorResolver
implements ErrorResolver
Handles errors for WebClient exceptions. Bad request is excluded and handled by
WebClientBadRequestExceptionErrorResolver.-
Constructor Summary
ConstructorsConstructorDescriptionWebClientExceptionErrorResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper, DataExchangeErrorProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if this resolver can map the exception to a readable error message.resolve(DataExchangeError error, Throwable t) Maps the exception to a readable error message.protected ObjecttryDeserializeResponseBody(org.springframework.web.reactive.function.client.WebClientResponseException e) Tries to deserialize the response body into a Map.Methods inherited from class com.broadleafcommerce.dataexchange.service.error.WebClientHttpRequestAwareErrorResolver
populateRequestInfoFields, setHeadersOnResponse
-
Constructor Details
-
WebClientExceptionErrorResolver
public WebClientExceptionErrorResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper, DataExchangeErrorProperties properties)
-
-
Method Details
-
canResolve
Description copied from interface:ErrorResolverReturns true if this resolver can map the exception to a readable error message.- Specified by:
canResolvein interfaceErrorResolver- Parameters:
t- the exception- Returns:
- true if this resolver can map the exception to a readable error message
-
resolve
Description copied from interface:ErrorResolverMaps the exception to a readable error message. The supplied error object will be initialized withDataExchangeError.getPath()populated. Implementations should handle populating any additional information that will be returned.It is possible for implementations to return a different error object than the one supplied. If this is needed, the returned error object should have the same path as the supplied error object.
- Specified by:
resolvein interfaceErrorResolver- Parameters:
error- The error object to populate.t- the exception- Returns:
- a readable error message
-
tryDeserializeResponseBody
protected Object tryDeserializeResponseBody(org.springframework.web.reactive.function.client.WebClientResponseException e) Tries to deserialize the response body into a Map. If it fails, it will return the response body as a String.- Parameters:
e- the WebClientResponseException- Returns:
- the deserialized response body or the response body as a String
-