一般来说,获得 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 这个项目。