io.vrap.rmf.base.client.error.ExceptionFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rmf-java-base Show documentation
Show all versions of rmf-java-base Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package io.vrap.rmf.base.client.error;
import io.vrap.rmf.base.client.ApiHttpException;
import io.vrap.rmf.base.client.ApiHttpRequest;
import io.vrap.rmf.base.client.ApiHttpResponse;
import io.vrap.rmf.base.client.ResponseSerializer;
/**
* @deprecated use {@link HttpExceptionFactory} instead
*/
@Deprecated
public class ExceptionFactory {
public static ApiHttpException create(final ApiHttpRequest request, final ApiHttpResponse response) {
if (response.getStatusCode() >= 500) {
return createServerException(request, response);
}
return createClientException(request, response);
}
public static ApiHttpException create(final ApiHttpRequest request, final ApiHttpResponse response,
final ResponseSerializer serializer) {
if (response.getStatusCode() >= 500) {
return createServerException(request, response, serializer);
}
return createClientException(request, response, serializer);
}
public static ApiHttpException createServerException(final ApiHttpRequest request,
final ApiHttpResponse response) {
return createServerException(request, response, ResponseSerializer.of());
}
public static ApiHttpException createServerException(final ApiHttpRequest request,
final ApiHttpResponse response, final ResponseSerializer serializer) {
return HttpExceptionFactory.of(serializer).createServerException(request, response);
}
public static ApiHttpException createClientException(final ApiHttpRequest request,
final ApiHttpResponse response) {
return createClientException(request, response, ResponseSerializer.of());
}
public static ApiHttpException createClientException(ApiHttpRequest request, ApiHttpResponse response,
final ResponseSerializer serializer) {
return HttpExceptionFactory.of(serializer).createClientException(request, response);
}
}