パッケージ twitter4j
クラス TwitterException
java.lang.Object
java.lang.Throwable
java.lang.Exception
twitter4j.TwitterException
- すべての実装されたインタフェース:
Serializable
,TwitterResponse
An exception class that will be thrown when TwitterAPI calls are failed.
In case the Twitter server returned HTTP error code, you can get the HTTP status code using getStatusCode() method.
In case the Twitter server returned HTTP error code, you can get the HTTP status code using getStatusCode() method.
- 関連項目:
-
ネストされたクラスの概要
インタフェースから継承されたネストされたクラス/インタフェース twitter4j.TwitterResponse
TwitterResponse.AccessLevel
-
フィールドの概要
修飾子とタイプフィールド説明static final int
Twitter is down or being upgraded.static final int
Bad Request: The request was invalid.static final int
Enhance Your Calm: Returned by the Search and Trends API when you are being rate limited.static final int
Forbidden: The request is understood, but it has been refused.static final int
//static final int
The Twitter servers are up, but the request couldn't be serviced due to some failure within our stack.static final int
Internal Server Error: Something is broken.static final int
//static final int
Not Acceptable: Returned by the Search API when an invalid format is specified in the request.static final int
Not Found: The URI requested is invalid or the resource requested, such as a user, does not exist.static final int
Not Modified: There was no new data to return.static final int
OK: Success!static final int
Service Unavailable: The Twitter servers are up, but overloaded with requests.static final int
Returned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource.static final int
Not Authorized: Authentication credentials were missing or incorrect.static final int
Returned when an image uploaded to POST account/update_profile_banner is unable to be processed. -
コンストラクタの概要
コンストラクタ説明TwitterException
(Exception cause) TwitterException
(String message) TwitterException
(String message, Exception cause, int statusCode) TwitterException
(String message, Throwable cause) TwitterException
(String message, twitter4j.HttpResponse res) -
メソッドの概要
修飾子とタイプメソッド説明boolean
boolean
Tests if the exception is caused by rate limitation exceedint
Returns error message from the API if available.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 causeReturns the current rate limit status if available.getResponseHeader
(String name) int
Returns int value of "Retry-After" response header (Search API) or seconds_until_reset (REST API).int
int
hashCode()
boolean
Tests if the exception is caused by network issueboolean
Tests if error message from the API is availableboolean
Tests if the exception is caused by non-existing resourcetoString()
クラスから継承されたメソッド java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
フィールド詳細
-
OK
static final int OKOK: Success!- 関連項目:
-
MULTIPLE_CHOICES
static final int MULTIPLE_CHOICES//- 関連項目:
-
FOUND
static final int FOUND//- 関連項目:
-
NOT_MODIFIED
static final int NOT_MODIFIEDNot Modified: There was no new data to return.- 関連項目:
-
BAD_REQUEST
static final int BAD_REQUESTBad Request: The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting.- 関連項目:
-
UNAUTHORIZED
static final int UNAUTHORIZEDNot Authorized: Authentication credentials were missing or incorrect.- 関連項目:
-
FORBIDDEN
static final int FORBIDDENForbidden: The request is understood, but it has been refused. An accompanying error message will explain why.- 関連項目:
-
NOT_FOUND
static final int NOT_FOUNDNot Found: The URI requested is invalid or the resource requested, such as a user, does not exist.- 関連項目:
-
NOT_ACCEPTABLE
static final int NOT_ACCEPTABLENot Acceptable: Returned by the Search API when an invalid format is specified in the request.- 関連項目:
-
ENHANCE_YOUR_CLAIM
static final int ENHANCE_YOUR_CLAIMEnhance Your Calm: Returned by the Search and Trends API when you are being rate limited. Not registered in RFC.- 関連項目:
-
UNPROCESSABLE_ENTITY
static final int UNPROCESSABLE_ENTITYReturned when an image uploaded to POST account/update_profile_banner is unable to be processed.- 関連項目:
-
TOO_MANY_REQUESTS
static final int TOO_MANY_REQUESTSReturned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource. See Rate Limiting in API v1.1.- 関連項目:
-
INTERNAL_SERVER_ERROR
static final int INTERNAL_SERVER_ERRORInternal Server Error: Something is broken. Please post to the group so the Twitter team can investigate.- 関連項目:
-
BAD_GATEWAY
static final int BAD_GATEWAYTwitter is down or being upgraded.- 関連項目:
-
SERVICE_UNAVAILABLE
static final int SERVICE_UNAVAILABLEService Unavailable: The Twitter servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited.- 関連項目:
-
GATEWAY_TIMEOUT
static final int GATEWAY_TIMEOUTThe Twitter servers are up, but the request couldn't be serviced due to some failure within our stack. Try again later.- 関連項目:
-
-
コンストラクタの詳細
-
TwitterException
- パラメータ:
message
- messagecause
- cause
-
TwitterException
- パラメータ:
message
- message
-
TwitterException
- パラメータ:
cause
- cause
-
TwitterException
- パラメータ:
message
- messageres
- response
-
TwitterException
- パラメータ:
message
- messagecause
- causestatusCode
- status code
-
-
メソッドの詳細
-
getMessage
- オーバーライド:
getMessage
クラス内Throwable
-
getStatusCode
public int getStatusCode()- 戻り値:
- status code
-
getErrorCode
public int getErrorCode()- 戻り値:
- error code
-
getResponseHeader
- パラメータ:
name
- header name- 戻り値:
- response header
-
getRateLimitStatus
インタフェースからコピーされた説明:TwitterResponse
Returns the current rate limit status if available.- 定義:
getRateLimitStatus
インタフェース内TwitterResponse
- 戻り値:
- current rate limit status
-
getAccessLevel
- 定義:
getAccessLevel
インタフェース内TwitterResponse
- 戻り値:
- application permission model
- 関連項目:
-
getRetryAfter
public int getRetryAfter()Returns int value of "Retry-After" response header (Search API) or seconds_until_reset (REST API). An application that exceeds the rate limitations of the Search API will receive HTTP 420 response codes to requests. It is a best practice to watch for this error condition and honor the Retry-After header that instructs the application when it is safe to continue. The Retry-After header's value is the number of seconds your application should wait before submitting another query (for example: Retry-After: 67).
Check if getStatusCode() == 503 before calling this method to ensure that you are actually exceeding rate limitation with query apis.- 戻り値:
- instructs the application when it is safe to continue in seconds
- 導入されたバージョン:
- Twitter4J 2.1.0
- 関連項目:
-
isCausedByNetworkIssue
public boolean isCausedByNetworkIssue()Tests if the exception is caused by network issue- 戻り値:
- if the exception is caused by network issue
- 導入されたバージョン:
- Twitter4J 2.1.2
-
exceededRateLimitation
public boolean exceededRateLimitation()Tests if the exception is caused by rate limitation exceed- 戻り値:
- if the exception is caused by rate limitation exceed
- 導入されたバージョン:
- Twitter4J 2.1.2
- 関連項目:
-
resourceNotFound
public boolean resourceNotFound()Tests if the exception is caused by non-existing resource- 戻り値:
- if the exception is caused by non-existing resource
- 導入されたバージョン:
- Twitter4J 2.1.2
-
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- 戻り値:
- a hexadecimal representation of this exception stacktrace
-
getErrorMessage
Returns error message from the API if available.- 戻り値:
- error message from the API
- 導入されたバージョン:
- Twitter4J 2.2.3
-
isErrorMessageAvailable
public boolean isErrorMessageAvailable()Tests if error message from the API is available- 戻り値:
- true if error message from the API is available
- 導入されたバージョン:
- Twitter4J 2.2.3
-
equals
-
hashCode
public int hashCode() -
toString
-