io.magentys.rest.RestResponseException Maven / Gradle / Ivy
package io.magentys.rest;
import io.magentys.rest.model.RestResponse;
public class RestResponseException extends RuntimeException {
public RestResponseException(String message) {
super(message);
}
public static void throwOnResponseFailure(final RestResponse response) {
if (response.failed()) {
throw new RestResponseException(String.format("Unexpected response status: %s, body: %s", response.statusCode(), response.body()));
}
}
}