package org.zendesk.client.v2; import java.io.IOException; import com.ning.http.client.Response; public class ZendeskResponseRateLimitException extends ZendeskResponseException { private static final long serialVersionUID = 1L; private static final String RETRY_AFTER_HEADER = "Retry-After"; private static final long DEFAULT_RETRY_AFTER = 60L; private Long retryAfter = DEFAULT_RETRY_AFTER; public ZendeskResponseRateLimitException(Response resp) throws IOException { super(resp); try { this.retryAfter = Long.valueOf(resp.getHeader(RETRY_AFTER_HEADER)); } catch (NumberFormatException e) { // Ignore, use the default value already set } } public Long getRetryAfter() { return retryAfter; } }