public class TwitterException extends java.lang.Exception implements TwitterResponse, twitter4j.internal.http.HttpResponseCode
Modifier and Type | Field and Description |
---|---|
private int |
errorCode |
private java.lang.String |
errorMessage |
private ExceptionDiagnosis |
exceptionDiagnosis |
private static java.lang.String[] |
FILTER |
(package private) boolean |
nested |
private twitter4j.internal.http.HttpResponse |
response |
private static long |
serialVersionUID |
private int |
statusCode |
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(java.lang.Exception cause) |
TwitterException(java.lang.String message) |
TwitterException(java.lang.String message,
java.lang.Exception cause,
int statusCode) |
TwitterException(java.lang.String message,
twitter4j.internal.http.HttpResponse res) |
TwitterException(java.lang.String message,
java.lang.Throwable cause) |
Modifier and Type | Method and Description |
---|---|
private void |
decode(java.lang.String str) |
boolean |
equals(java.lang.Object o) |
boolean |
exceededRateLimitation()
Tests if the exception is caused by rate limitation exceed
|
int |
getAccessLevel() |
private static java.lang.String |
getCause(int statusCode) |
int |
getErrorCode() |
java.lang.String |
getErrorMessage()
Returns error message from the API if available.
|
java.lang.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 |
private ExceptionDiagnosis |
getExceptionDiagnosis() |
java.lang.String |
getMessage() |
RateLimitStatus |
getRateLimitStatus()
Returns the current rate limit status if available.
|
java.lang.String |
getResponseHeader(java.lang.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
|
(package private) void |
setNested() |
java.lang.String |
toString() |
private int statusCode
private int errorCode
private static final long serialVersionUID
private ExceptionDiagnosis exceptionDiagnosis
private twitter4j.internal.http.HttpResponse response
private java.lang.String errorMessage
private static final java.lang.String[] FILTER
boolean nested
public TwitterException(java.lang.String message, java.lang.Throwable cause)
public TwitterException(java.lang.String message)
public TwitterException(java.lang.Exception cause)
public TwitterException(java.lang.String message, twitter4j.internal.http.HttpResponse res)
public TwitterException(java.lang.String message, java.lang.Exception cause, int statusCode)
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
private void decode(java.lang.String str)
public int getStatusCode()
public int getErrorCode()
public java.lang.String getResponseHeader(java.lang.String name)
public RateLimitStatus getRateLimitStatus()
getRateLimitStatus
in interface TwitterResponse
public int getAccessLevel()
getAccessLevel
in interface TwitterResponse
public int getRetryAfter()
public boolean isCausedByNetworkIssue()
public boolean exceededRateLimitation()
public boolean resourceNotFound()
public java.lang.String getExceptionCode()
private ExceptionDiagnosis getExceptionDiagnosis()
void setNested()
public java.lang.String getErrorMessage()
public boolean isErrorMessageAvailable()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Throwable
private static java.lang.String getCause(int statusCode)