0

一般来说,获得 API 针对任何特定请求返回的所有可能错误的某种描述会很棒。这将使实现更加可靠,并改善用户的应用程序反馈。

想象一下,我们需要向用户显示本地化的错误消息,而不仅仅是“Request failed with error code xxx”。

一个很好的例子就是这个错误{"error":"flattr_once","error_description":"You are not allowed to flattr this thing more than once this period","error_uri":"http:\/\/developers.flattr.net\/api"}。文档中没有提到它,但应用程序需要理解这一点,并且可能避免让用户在未来选择 flattr 这个项目。

4

2 回答 2

1

这是我在奉承时发现的一些回应:

403{"error":"flattr_once","error_description":"You are not allowed to flattr this thing more than once this period","error_uri":"http:\/\/developers.flattr.net\/api"}

401{"error":"no_means","error_description":"You don't have any money to flattr with","error_uri":"http:\/\/developers.flattr.net\/api"}

{"error":"flattr_owner","error_description":"You are not allowed to flattr your own thing","error_uri":"http:\/\/developers.flattr.net\/api"}

于 2012-01-31T14:33:23.480 回答
0

开发者文档中有几个错误描述。例如,扁平化失败时的错误响应以及许多资源通用的标准错误。

于 2012-02-15T18:40:57.227 回答