![JAR search and dependency download from the Maven repository](/logo.png)
com.dft.api.shopify.exceptions.ShopifyErrorResponseException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-admin-rest Show documentation
Show all versions of shopify-admin-rest Show documentation
Shopify Admin REST API using JDK 11 and Reactive Programming
The newest version!
package com.dft.api.shopify.exceptions;
import java.util.List;
import javax.ws.rs.core.Response;
public class ShopifyErrorResponseException extends RuntimeException {
static final String MESSAGE = "Received unexpected Response Status Code of %d\nResponse Headers of:\n%s\nResponse Body of:\n%s";
private final int statusCode;
private static final long serialVersionUID = 5646635633348617058L;
private final String responseBody;
private final List shopifyErrorCodes;
public ShopifyErrorResponseException(final Response response) {
super(buildMessage(response));
response.bufferEntity();
this.responseBody = response.readEntity(String.class);
this.shopifyErrorCodes = ShopifyErrorCodeFactory.create(responseBody);
this.statusCode = response.getStatus();
}
private static String buildMessage(final Response response) {
response.bufferEntity();
final String readEntity = response.readEntity(String.class);
return String.format(MESSAGE, response.getStatus(), response.getStringHeaders(), readEntity);
}
public int getStatusCode() {
return statusCode;
}
public String getResponseBody() {
return responseBody;
}
public List getShopifyErrorCodes() {
return shopifyErrorCodes;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy