Twitter::API::Error - Twitter API exception
version 0.0102
use Try::Tiny; use Twitter::API; use Twitter::API::Util 'is_twitter_api_error'; my $client = Twitter::API->new(%options); try { my $r = $client->get('account/verify_credentials'); } catch { die $_ unless _is_twitter_api_error; warn "Twitter says: ", $_->twitter_error_text; };
Twitter::API dies, throwing a Twitter::API::Error exception when it receives an error. The error object contains information about the error so your code can decide how to respond to various error conditions.
Returns the HTTP::Request object used to make the Twitter API call.
Returns the HTTP::Response object for the API call.
Returns the inflated JSON error response from Twitter (if any).
Returns a Devel::StackTrace object encapsulating the call stack so you can discover, where, in your application the error occurred.
Delegates to <stack_trace-frame>>. See Devel::StackTrace for details.
<stack_trace-
Delegates to <stack_trace-next_frame>>. See Devel::StackTrace for details.
Returns a reasonable string representation of the exception. If Twitter returned error information in the form of a JSON body, it is mined for error text. Otherwise, the HTTP response status line is used. The stack frame is mined for the point in your application where the request initiated and appended to the message.
When used in a string context, error is called to stringify exception.
error
Returns the numeric error code returned by Twitter, or 0 if there is none. See https://dev.twitter.com/overview/api/response-codes for details.
Returns true if the error represents a problem with the access token or its Twitter account, rather than with the resource being accessed.
Some Twitter error codes indicate a problem with authentication or the token/secret used to make the API call. For example, the account has been suspended or access to the application revoked by the user. Other error codes indicate a problem with the resource requested. For example, the target account no longer exists.
Delegates to <http_response-code>>. Returns the HTTP status code of the response.
<http_response-
Returns true for HTTP status codes representing an error and with values less than 500. Typically, retrying an API call with one of these statuses right away will simply result in the same error, again.
Returns true or HTTP status codes of 500 or greater. Often, these errors indicate a transient condition. Retrying the API call right away may result in success. See the RetryOnError for automatically retrying temporary errors.
Marc Mims <marc@questright.com>
This software is copyright (c) 2015-2016 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Twitter::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Twitter::API
CPAN shell
perl -MCPAN -e shell install Twitter::API
For more information on module installation, please visit the detailed CPAN module installation guide.