The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojo::WebService::Twitter::Error - Container for API errors

SYNOPSIS

 my $error = Mojo::WebService::Twitter::Error->new->from_tx($tx);
 warn "$_->{code}: $_->{message}\n" for @{$error->api_errors};
 die $error->to_string;

DESCRIPTION

Mojo::WebService::Twitter::Error is a container for API errors received from the Twitter API via Mojo::WebService::Twitter.

FUNCTIONS

Mojo::WebService::Twitter::Error exports the following functions on demand.

twitter_tx_error

 my $error = twitter_tx_error($tx);

Creates a new Mojo::WebService::Twitter::Error and populates it using "from_tx".

ATTRIBUTES

Mojo::WebService::Twitter::Error implements the following attributes.

api_errors

 my $errors = $error->api_errors;
 $error     = $error->api_errors([{code => 215, message => 'Bad Authentication data.'}]);

Arrayref of error codes and messages received from the Twitter API.

connection_error

 my $message = $error->connection_error;
 $error      = $error->connection_error('Inactivity timeout');

Connection error if any.

http_status

 my $status = $error->http_status;
 $error     = $error->http_status(404);

HTTP status code returned by Twitter API.

http_message

 my $message = $error->http_message;
 $error      = $error->http_message('Not Found');

HTTP status message returned by Twitter API.

METHODS

Mojo::WebService::Twitter::Error inherits all methods from Mojo::Base, and implements the following new ones.

from_tx

 $error = $error->from_tx($tx);

Load connection, API, and HTTP error data from transaction.

to_string

 my $string = $error->to_string;

String representation of connection, API, or HTTP error.

OPERATORS

Mojo::WebService::Twitter::Error overloads the following operators.

bool

Always true.

stringify

Alias for "to_string".

BUGS

Report any issues on the public bugtracker.

AUTHOR

Dan Book <dbook@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Dan Book.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

SEE ALSO

Mojo::WebService::Twitter