// Path: src/main/java/re/vianneyfaiv/persephone/exception/HttpRedirectErrorException.java
// public class HttpRedirectErrorException extends HttpStatusCodeException {
// 
// 	private static final long serialVersionUID = 6338405670035326036L;
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode) {
// 		super(statusCode);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText) {
// 		super(statusCode, statusText);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset) {
// 		super(statusCode, statusText, responseBody, responseCharset);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset) {
// 		super(statusCode, statusText, responseHeaders, responseBody, responseCharset);
// 	}
// 
// }


import java.io.IOException;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import re.vianneyfaiv.persephone.exception.HttpRedirectErrorException;
package re.vianneyfaiv.persephone.config;




/**
 * Handle HTTP 3xx as errors
 */
@Configuration
public class RestErrorHandler extends DefaultResponseErrorHandler {

	@Override
	protected boolean hasError(HttpStatus statusCode) {
		return statusCode.series() == HttpStatus.Series.REDIRECTION || super.hasError(statusCode);
	}

	@Override
	public void handleError(ClientHttpResponse response) throws IOException {
		HttpStatus statusCode = getHttpStatusCode(response);

		// handle 3xx
		switch (statusCode.series()) {
			case REDIRECTION:
// Path: src/main/java/re/vianneyfaiv/persephone/exception/HttpRedirectErrorException.java
// public class HttpRedirectErrorException extends HttpStatusCodeException {
// 
// 	private static final long serialVersionUID = 6338405670035326036L;
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode) {
// 		super(statusCode);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText) {
// 		super(statusCode, statusText);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset) {
// 		super(statusCode, statusText, responseBody, responseCharset);
// 	}
// 
// 	public HttpRedirectErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset) {
// 		super(statusCode, statusText, responseHeaders, responseBody, responseCharset);
// 	}
// 
// }


// Path: src/main/java/re/vianneyfaiv/persephone/config/RestErrorHandler.java
import java.io.IOException;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import re.vianneyfaiv.persephone.exception.HttpRedirectErrorException;

package re.vianneyfaiv.persephone.config;




/**
 * Handle HTTP 3xx as errors
 */
@Configuration
public class RestErrorHandler extends DefaultResponseErrorHandler {

	@Override
	protected boolean hasError(HttpStatus statusCode) {
		return statusCode.series() == HttpStatus.Series.REDIRECTION || super.hasError(statusCode);
	}

	@Override
	public void handleError(ClientHttpResponse response) throws IOException {
		HttpStatus statusCode = getHttpStatusCode(response);

		// handle 3xx
		switch (statusCode.series()) {
			case REDIRECTION:
				throw new HttpRedirectErrorException(statusCode, response.getStatusText(),