Reputation: 991
When I use Facebook api()
method, it work correctly when I got permission, but when a user reject some extended permission and my php script ask for that data an error occurs and the script stuck. So after api()
request no more instructions are executed.
How can I handle that error? I can't even get to those data to find out that there is an error, because like I said the script stuck.
Upvotes: 0
Views: 1839
Reputation: 13985
Every time facebook return an error code the Facebook api return an FacebookApiException.
So use a try-catch block whenever you are calling the api() method.
try{
f.api("whatever");
}catch (FacebookApiException $e) {
// most likely that user very recently revoked authorization.
// In any event, we don't have an access token, so say so.
echo "Something went wrong";
}
Upvotes: 3
Reputation: 3437
Permissions can be revoked by the user at any time, so even if you had previously been granted a permission, that does not mean you still have it.
If facebook is sticking when requesting certain data you do not have permissions for, the only solution would be to check if you have the required permissions before executing the command.
see how to check special permissions in facebook
Upvotes: 1