View Source Tw.V1_1.TwitterAPIError exception (Tw v0.1.0)

Exception which wraps an error response from Twitter API.

See the Twitter API documentation for details.

Link to this section Summary

Functions

Return DateTime when the rate limit is reset. If the given error is not related to rate limiting, return nil.

Return time until rate limit is reset in milliseconds. If the given error is not related to rate limiting, return nil.

Link to this section Types

Specs

t() :: %Tw.V1_1.TwitterAPIError{
  __exception__: true,
  errors: [%{message: binary(), code: pos_integer()}],
  message: binary(),
  response: Tw.HTTP.Response.t()
}

Link to this section Functions

Link to this function

member_not_found?(error)

View Source

Specs

member_not_found?(t()) :: boolean()

Specs

no_user_matched?(t()) :: boolean()
Link to this function

rate_limit_exceeded?(error)

View Source

Specs

rate_limit_exceeded?(t()) :: boolean()
Link to this function

rate_limit_reset_at(error)

View Source

Specs

rate_limit_reset_at(t()) :: DateTime.t() | nil

Return DateTime when the rate limit is reset. If the given error is not related to rate limiting, return nil.

Link to this function

rate_limit_reset_in(error, base_fn \\ fn -> DateTime.utc_now() |> DateTime.to_unix(:second) end)

View Source

Return time until rate limit is reset in milliseconds. If the given error is not related to rate limiting, return nil.

Examples

TwitterAPIError.rate_limit_reset_in(error)
|> Process.sleep()
Link to this function

resource_not_found?(error)

View Source

Specs

resource_not_found?(t()) :: boolean()
Link to this function

subscriber_not_found?(error)

View Source

Specs

subscriber_not_found?(t()) :: boolean()

Specs

user_not_found?(t()) :: boolean()