All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ebay.exceptions.EbayErrorException Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package com.ebay.exceptions;

import javax.ws.rs.core.Response;

public class EbayErrorException extends RuntimeException {

	static final String MESSAGE = "Received unexpected Response Status Code of %d and Body of:\n%s";

	private static final long serialVersionUID = 4291284903448380314L;

	public EbayErrorException(final Exception exception) {
		super(exception);
	}

	public EbayErrorException(final Response response) {
		super(buildMessage(response));
	}

	private static String buildMessage(final Response response) {
		response.bufferEntity();
		return String.format(MESSAGE, response.getStatus(), response.readEntity(String.class));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy