
io.sphere.internal.errors.SphereErrorResponse Maven / Gradle / Ivy
package io.sphere.internal.errors;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import io.sphere.client.SphereError;
import javax.annotation.Nonnull;
import java.util.List;
/** Response object returned by the Sphere Projects Web Service in case of an error.
* @see API documentation */
public class SphereErrorResponse {
private int statusCode;
private String message = "";
@Nonnull private List errors = ImmutableList.of();
// for JSON deserializer
private SphereErrorResponse() {}
/** The HTTP status code. */
public int getStatusCode() { return statusCode; }
/** The message of the first error, for convenience. */
public String getMessage() { return message; }
/** The individual errors. */
@Nonnull public List getErrors() { return errors; }
@Override public String toString() {
return String.format("[" + getStatusCode() + "]" + "\n " + Joiner.on("\n ").join(getErrors()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy