nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

Add error code accessors to exception #323

Closed dangerp closed 11 years ago

dangerp commented 11 years ago

Sometimes, the best way of handling an error from the FB Graph API is to perform an action based on the error code that they provide (see the FB error docs). Additionally, often an application should take different actions based on the code or subcode.

This PR simply records the code and the subcode (if any) provided by FB, and makes it available in an accessor. I was also working on code to provide the mapping to the Error Recovery Tactics listed on the documentation page, but I quickly realized that not all of the error codes that can be returned from facebook are listed on that page. If you have any ideas on how to handle unknowns, let me know and I'll push up the commit