Class RestErrorHandler
java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.api.RestErrorHandler
- All Implemented Interfaces:
org.springframework.web.client.ResponseErrorHandler
public class RestErrorHandler
extends Object
implements org.springframework.web.client.ResponseErrorHandler
Rest error handler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringextractErrorResponse(org.springframework.http.client.ClientHttpResponse response) Try to create a string from the error response with the only purpose to be logged.voidhandleError(org.springframework.http.client.ClientHttpResponse response) Handle a product error response, that is, throw the properkukenanException.booleanhasError(org.springframework.http.client.ClientHttpResponse response) protected voidthrowBadRequestSpecificException(String errorMsg, String errorResponseBody) Throws the specific bad request exception from the error response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.client.ResponseErrorHandler
handleError
-
Constructor Details
-
RestErrorHandler
public RestErrorHandler()
-
-
Method Details
-
hasError
public boolean hasError(org.springframework.http.client.ClientHttpResponse response) throws IOException - Specified by:
hasErrorin interfaceorg.springframework.web.client.ResponseErrorHandler- Throws:
IOException
-
handleError
public void handleError(org.springframework.http.client.ClientHttpResponse response) Handle a product error response, that is, throw the properkukenanException.- Specified by:
handleErrorin interfaceorg.springframework.web.client.ResponseErrorHandler- Parameters:
response- error response.
-
throwBadRequestSpecificException
Throws the specific bad request exception from the error response.- Parameters:
errorMsg- error message.errorResponseBody- error response body.
-
extractErrorResponse
Try to create a string from the error response with the only purpose to be logged.- Parameters:
response-ClientHttpResponse.- Returns:
- a string from the error response.
-