NAME
WWW::Kickstarter::Error - Kickstarter error information
SYNOPSIS
use WWW::Kickstarter;
my $email = '...'; # Your Kickstarter login credentials
my $password = '...';
my $ks = WWW::Kickstarter->new();
$ks->login($email, $password);
my $exists = 1;
if (!eval { $ks->user($user_id); 1 }) {
my $e = WWW::Kickster::Error->new($@);
die $e if $e->code != 404;
$exists = 0;
}
DESCRIPTION
By throwing objects of this class rather than a string, the caller can identify certain errors programatically without relying on matching the exact text of the message.
CONSTRUCTOR
new
my $error = WWW::Kickstarter::Error->new($code, $message);
my $error = WWW::Kickstarter::Error->new($message);
Creates an WWW::Kickstarter::Error object from the specified $code
and $message
. See code
for acceptable values for $code
.
If $message
is an WWW::Kickstarter::Error object, it is simply returned.
SUBROUTINES
my_croak
my_croak($code, $message);
Creates a WWW::Kickstarter::Error object from the arguments and throws it as an exception.
ACCESSORS
code
my $code = $error->code();
The $code
passed to my_croak
or the constructor.
One of the following:
400
to499
Invalid arguments provided.
401
Authentication failure. The user does not exist, or an incorrect password was supplied.
404
The specified user, project or category does not exist.
500
to599
A communication error or an unrecognized response.
message
my $message = $error->message();
The $message
passed to my_croak
or the constructor.
as_string
my $message = $error->as_string();
my $message = "$error";
An error message complete with the file name and line number of the call into the WWW::Kickstarter library.
EXPORTS
The following are exported on demand:
my_croak
VERSION, BUGS, KNOWN ISSUES, SUPPORT, AUTHORS, COPYRIGHT & LICENSE
See WWW::Kickstarter