use of org.craftercms.profile.api.exceptions.ErrorCode in project profile by craftercms.
the class AbstractProfileRestClientBase method handleRestServiceException.
protected void handleRestServiceException(RestServiceException e) throws ProfileException {
if (e.getErrorDetails() instanceof ErrorDetails) {
ErrorDetails errorDetails = (ErrorDetails) e.getErrorDetails();
HttpStatus responseStatus = e.getResponseStatus();
ErrorCode errorCode = errorDetails.getErrorCode();
String message = errorDetails.getMessage();
throw new ProfileRestServiceException(responseStatus, errorCode, message);
} else {
HttpStatus responseStatus = e.getResponseStatus();
String message = e.getErrorDetails().toString();
throw new ProfileRestServiceException(responseStatus, message);
}
}
Aggregations