Facebook图谱API错误代码列表。

34

我在哪里可以找到Graph API官方错误代码列表?

我已经使用Graph API半年了,在过去的6个月中,错误代码的格式已经更改了两次!

我第一次看到错误代码时,它是这样的:

{   
    "error": {
        "message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",      
        "type": "OAuthException",      
    }
}

这真是奇怪,错误信息没有提供任何错误代码!

几个月后,"预期的"错误代码被引入。

{   
    "error": {
        "message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",      
        "type": "OAuthException",      
        "code": 190,      
    }
}

但是可悲的是,仅仅通过检查“代码”,仍然无法确定错误的具体原因,因为许多同一“类型”的错误具有相同的“代码”。

刚刚发现错误消息中包含新的字段:

{   
    "error": {
        "message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",      
        "type": "OAuthException",      
        "code": 190,      
        "error_subcode": 460   
    }
}

好的,这正是我需要的。

但是我在哪里能找到错误代码列表呢?我知道有FQL错误代码列表,http://fbdevwiki.com/wiki/Error_codes#FQL_Errors,但它看起来已经过时,而且没有提供任何关于“error_subcode”的消息。


2
可能是Facebook错误代码列表的重复。 - Jonathan Hall
https://developers.facebook.com/docs/graph-api/using-graph-api/error-handling - cardamom
4个回答

24

Facebook开发者维基(非官方)不仅包含FQL错误代码列表,还有其他内容。它有点更新,但不包含所有可能的错误代码列表。

目前没有官方或真正更新的Graph API返回的错误代码列表。在线找到的每个列表都已过时,帮助不大......

有官方列表描述一些API错误和基本恢复策略。此外,还有一些针对特定代码的官方列表:


OAuth错误链接已经无法使用。正确的网址在以下另一个答案中,https://developers.facebook.com/docs/reference/api/errors/。 - Jaffer

13

更具体地说,这个页面:https://developers.facebook.com/docs/graph-api/using-graph-api/error-handling - Supertecnoboff

5

我还发现了一些OAuth异常的错误子代码。这些代码来自Facebook bugtracker,没有任何保证(可能包含已废弃、错误和已停用的内容):

/**
  * (Date: 30.01.2013)
  *
  * case 1: - "An error occured while creating the share (publishing to wall)"
  *         - "An unknown error has occurred."
  * case 2:    "An unexpected error has occurred. Please retry your request later."
  * case 3:    App must be on whitelist        
  * case 4:    Application request limit reached
  * case 5:    Unauthorized source IP address        
  * case 200:  Requires extended permissions
  * case 240:  Requires a valid user is specified (either via the session or via the API parameter for specifying the user."
  * case 1500: The url you supplied is invalid
  * case 200:
  * case 210:  - Subject must be a page
  *            - User not visible
  */

 /**
  * Error Code 100 several issus:
  * - "Specifying multiple ids with a post method is not supported" (http status 400)
  * - "Error finding the requested story" but it is available via GET
  * - "Invalid post_id"
  * - "Code was invalid or expired. Session is invalid."
  * 
  * Error Code 2: 
  * - Service temporarily unavailable
  */

嗨,你在哪里找到那个列表的? - Aleksandra Kłapcińska
我没有找到这个列表。在阅读了许多许多的错误后,我记录下了我发现的每一个异常及其编号。但由于过去也有一些更改,所以不能保证完全正确。我已经丢弃了太旧的错误报告。 - Jens Peters

0

1
实际上,你所提到的问题的大多数答案都包含与http://fbdevwiki.com/wiki/Error_codes上列出的完全相同的错误代码列表,但是这些答案甚至更过时... - Juicy Scripter

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接