Class WebClientBadRequestExceptionErrorResolver
java.lang.Object
com.broadleafcommerce.dataexchange.service.error.WebClientHttpRequestAwareErrorResolver
com.broadleafcommerce.dataexchange.service.error.WebClientBadRequestExceptionErrorResolver
- All Implemented Interfaces:
ErrorResolver
@Order(2147483547)
public class WebClientBadRequestExceptionErrorResolver
extends WebClientHttpRequestAwareErrorResolver
implements ErrorResolver
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWebClientBadRequestExceptionErrorResolver(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.deserializeResponseBody(org.springframework.web.reactive.function.client.WebClientResponseException.BadRequest badRequest) protected com.fasterxml.jackson.databind.ObjectMapperprotected voidhandleBadRequestError(DataExchangeError error, Map<String, Object> responseBodyMap, org.springframework.web.reactive.function.client.WebClientResponseException.BadRequest badRequest) protected voidhandleValidationException(DataExchangeError error, Map<String, Object> responseBodyMap, org.springframework.web.reactive.function.client.WebClientResponseException.BadRequest exception) protected booleanisValidationException(Map<String, Object> responseBody) protected ValidationResponsemapValidationException(Map<String, Object> responseBody) resolve(DataExchangeError error, Throwable t) Maps the exception to a readable error message.Methods inherited from class com.broadleafcommerce.dataexchange.service.error.WebClientHttpRequestAwareErrorResolver
populateRequestInfoFields, setHeadersOnResponse
-
Field Details
-
VALIDATION_ERROR_TYPE
- See Also:
-
BAD_REQUEST_ERROR_TYPE
- See Also:
-
-
Constructor Details
-
WebClientBadRequestExceptionErrorResolver
public WebClientBadRequestExceptionErrorResolver(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
-
handleBadRequestError
protected void handleBadRequestError(DataExchangeError error, Map<String, Object> responseBodyMap, org.springframework.web.reactive.function.client.WebClientResponseException.BadRequest badRequest) -
handleValidationException
protected void handleValidationException(DataExchangeError error, Map<String, Object> responseBodyMap, org.springframework.web.reactive.function.client.WebClientResponseException.BadRequest exception) -
deserializeResponseBody
-
isValidationException
-
mapValidationException
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-