NAME
Facebook::Graph::Exception - The exceptions thrown by this module.
VERSION
version 1.0100
Description
Facebook::Graph throws exceptions when it encounters a problem. All exceptions are derived from Exception::Class.
If you don't plan on using exceptions to trap problems, you can very easily just trap them like a normal die
like this:
eval { $fb->do_something };
if ($@) {
say "An error occurred with the following message: ". $@;
}
EXCEPTIONS
Facebok::Graph::Exception::General
A general purpose exception. No special methods. Example:
eval { $fb->do_something }
my $e;
if ($e = Exception::Class->caught('Facebook::Graph::Exception::General')) {
warn $e->error;
exit;
}
Facebook::Graph::Exception::RPC
An exception that is thrown communicating with Facebook. It has several extra methods.
eval { $fb->do_something }
my $e;
if ($e = Exception::Class->caught('Facebook::Graph::Exception::RPC')) {
warn $e->error;
warn $e->http_code;
warn $e->http_message;
warn $e->facebook_message;
warn $e->facebook_type;
warn $e->uri
exit;
}
http_code
The HTTP status code can be used to help figure out what went wrong: Example: 401
.
http_message
The HTTP status message usually isn't all that useful, but in case you need it, here it is. Example: Authorization Required
.
facebook_message
Facebook will return an error message to help you diagnose what is wrong with your request, which can sometimes be useful. Example: Error validating application.
facebook_type
Facebook returns various exception types that can sometimes be helpful in diagnosing problems. Example: OAuthException
.
uri
The URI used to request information from Facebook. In the case of a GET this can be very useful. Not so useful on a POST.
LEGAL
Facebook::Graph is Copyright 2010 Plain Black Corporation (http://www.plainblack.com) and is licensed under the same terms as Perl itself.