Using the Facebook REST API PHP client library, it seems wise to wrap calls in try{}
thus:
require('facebook.php');
$fb = new Facebook($fbApiKey, $fbSecret);
try {
$result = $fb->api_client->some_api_method(...);
} catch (FacebookRestClientException $e) {
// now what?
}
But I'm not sure what to do with the exception, e.g. to find out what went wrong or to write a sensible message to the error log. Is there documentation for these exceptions somewhere?
After examining the code and some example exceptions, I think $e
is an object looking something like this:
(
[message:protected] => An error message string
[string:Exception:private] => Don't know
[code:protected] => A numerical error code
[file:protected] => File here the exception was thrown
[line:protected] => Line where the exception was thrown
[trace:Exception:private] => A PHP debug_backtrace() result
[previous:Exception:private] => Don't know
)