Error Code Handling

Having developed some error handling code inside my Unity application to perform user actions when a Facebook denial request (like forcing a local user to log out or requesting a new permission), I saw some inconsistencies between the HTML API (Error Code Handling) and the results. which I get for failed requests.

When you try to publish a score ( API points ) without granting write access to my application, the request assigned to the callback receives FBResult, containing

result.Error == "403 Forbidden"

instead of being related to:

result.Error == {
    "error": {
        "message": "API Permission Denied", 
        "type": "", 
        "code": 10 ,
        "error_subcode": 467
    }
}

When you look at the FB friendsmash-unity sample , they ignore the errors presented in the following code snippet:

void APICallback(FBResult result)
{
    Util.Log("APICallback");
    if (result.Error != null)
    {
        Util.LogError(result.Error);
        // Let just try again
        FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
        return;
    }
  • Facebook API- Graph API ?

  • JSON-, HTTP-?

  • Facebook Unity?

+4
1

1) Unity WWW, , , . , result.Error , result.Text , . API- Scores API Graph API . , . - , : https://developers.facebook.com/bugs

2) , "". , .

3) , API- Graph, , , - . HTTP result.Error . , - result.Error . -, , .

+2

Source: https://habr.com/ru/post/1534277/


All Articles