public class TwitterException extends Exception implements TwitterResponse, HttpResponseCode
NONE, READ, READ_WRITE, READ_WRITE_DIRECTMESSAGES
BAD_GATEWAY, BAD_REQUEST, ENHANCE_YOUR_CLAIM, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, INTERNAL_SERVER_ERROR, MULTIPLE_CHOICES, NOT_ACCEPTABLE, NOT_FOUND, NOT_MODIFIED, OK, SERVICE_UNAVAILABLE, TOO_MANY_REQUESTS, UNAUTHORIZED, UNPROCESSABLE_ENTITY
Constructor and Description |
---|
TwitterException(Exception cause) |
TwitterException(String message) |
TwitterException(String message,
Exception cause,
int statusCode) |
TwitterException(String message,
HttpResponse res) |
TwitterException(String message,
Throwable cause) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
boolean |
exceededRateLimitation()
Tests if the exception is caused by rate limitation exceed
|
int |
getAccessLevel() |
int |
getErrorCode() |
String |
getErrorMessage()
Returns error message from the API if available.
|
String |
getExceptionCode()
Returns a hexadecimal representation of this exception stacktrace.
An exception code is a hexadecimal representation of the stacktrace which enables it easier to Google known issues. Format : XXXXXXXX:YYYYYYYY[ XX:YY] Where XX is a hash code of stacktrace without line number YY is a hash code of stacktrace excluding line number [-XX:YY] will appear when this instance a root cause |
String |
getMessage() |
RateLimitStatus |
getRateLimitStatus()
Returns the current rate limit status if available.
|
String |
getResponseHeader(String name) |
int |
getRetryAfter()
Returns int value of "Retry-After" response header (Search API) or seconds_until_reset (REST API).
|
int |
getStatusCode() |
int |
hashCode() |
boolean |
isCausedByNetworkIssue()
Tests if the exception is caused by network issue
|
boolean |
isErrorMessageAvailable()
Tests if error message from the API is available
|
boolean |
resourceNotFound()
Tests if the exception is caused by non-existing resource
|
String |
toString() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public TwitterException(String message)
public TwitterException(Exception cause)
public TwitterException(String message, HttpResponse res)
public String getMessage()
getMessage
in class Throwable
public int getStatusCode()
public int getErrorCode()
public RateLimitStatus getRateLimitStatus()
TwitterResponse
getRateLimitStatus
in interface TwitterResponse
public int getAccessLevel()
getAccessLevel
in interface TwitterResponse
public int getRetryAfter()
public boolean isCausedByNetworkIssue()
public boolean exceededRateLimitation()
public boolean resourceNotFound()
public String getExceptionCode()
public String getErrorMessage()
public boolean isErrorMessageAvailable()
Copyright © 2018. All rights reserved.