パッケージ twitter4j

クラス TwitterException

すべての実装されたインタフェース:
Serializable, TwitterResponse

public class TwitterException extends Exception implements 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.
関連項目:
  • フィールド詳細

    • OK

      static final int OK
      OK: Success!
      関連項目:
    • MULTIPLE_CHOICES

      static final int MULTIPLE_CHOICES
      //
      関連項目:
    • FOUND

      static final int FOUND
      //
      関連項目:
    • NOT_MODIFIED

      static final int NOT_MODIFIED
      Not Modified: There was no new data to return.
      関連項目:
    • BAD_REQUEST

      static final int BAD_REQUEST
      Bad 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 UNAUTHORIZED
      Not Authorized: Authentication credentials were missing or incorrect.
      関連項目:
    • FORBIDDEN

      static final int FORBIDDEN
      Forbidden: The request is understood, but it has been refused. An accompanying error message will explain why.
      関連項目:
    • NOT_FOUND

      static final int NOT_FOUND
      Not Found: The URI requested is invalid or the resource requested, such as a user, does not exist.
      関連項目:
    • NOT_ACCEPTABLE

      static final int NOT_ACCEPTABLE
      Not Acceptable: Returned by the Search API when an invalid format is specified in the request.
      関連項目:
    • ENHANCE_YOUR_CLAIM

      static final int ENHANCE_YOUR_CLAIM
      Enhance 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_ENTITY
      Returned when an image uploaded to POST account/update_profile_banner is unable to be processed.
      関連項目:
    • TOO_MANY_REQUESTS

      static final int TOO_MANY_REQUESTS
      Returned 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_ERROR
      Internal Server Error: Something is broken. Please post to the group so the Twitter team can investigate.
      関連項目:
    • BAD_GATEWAY

      static final int BAD_GATEWAY
      Twitter is down or being upgraded.
      関連項目:
    • SERVICE_UNAVAILABLE

      static final int SERVICE_UNAVAILABLE
      Service 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_TIMEOUT
      The Twitter servers are up, but the request couldn't be serviced due to some failure within our stack. Try again later.
      関連項目:
  • コンストラクタの詳細

    • TwitterException

      public TwitterException(String message, Throwable cause)
      パラメータ:
      message - message
      cause - cause
    • TwitterException

      public TwitterException(String message)
      パラメータ:
      message - message
    • TwitterException

      public TwitterException(Exception cause)
      パラメータ:
      cause - cause
    • TwitterException

      public TwitterException(String message, twitter4j.HttpResponse res)
      パラメータ:
      message - message
      res - response
    • TwitterException

      public TwitterException(String message, Exception cause, int statusCode)
      パラメータ:
      message - message
      cause - cause
      statusCode - status code
  • メソッドの詳細

    • getMessage

      public String getMessage()
      オーバーライド:
      getMessage クラス内 Throwable
    • getStatusCode

      public int getStatusCode()
      戻り値:
      status code
    • getErrorCode

      public int getErrorCode()
      戻り値:
      error code
    • getResponseHeader

      public String getResponseHeader(String name)
      パラメータ:
      name - header name
      戻り値:
      response header
    • getRateLimitStatus

      public RateLimitStatus getRateLimitStatus()
      インタフェースからコピーされた説明: TwitterResponse
      Returns the current rate limit status if available.
      定義:
      getRateLimitStatus インタフェース内 TwitterResponse
      戻り値:
      current rate limit status
    • getAccessLevel

      public TwitterResponse.AccessLevel 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

      public 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
      戻り値:
      a hexadecimal representation of this exception stacktrace
    • getErrorMessage

      public String 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

      public boolean equals(Object o)
      オーバーライド:
      equals クラス内 Object
    • hashCode

      public int hashCode()
      オーバーライド:
      hashCode クラス内 Object
    • toString

      public String toString()
      オーバーライド:
      toString クラス内 Throwable