{"comment":{"created_at":"2011-10-21T02:50:02Z","body":"Thanks - happy to see it merged!","updated_at":"2011-10-21T02:50:02Z","url":"https://api.github.com/repos/mattmueller/foursquare2/issues/comments/2477182","id":2477182,"user":{"avatar_url":"https://secure.gravatar.com/avatar/22ca530c1db575f0a62b68c1900d8399?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"22ca530c1db575f0a62b68c1900d8399","url":"https://api.github.com/users/robgleeson","id":77573,"login":"robgleeson"}},"action":"created","issue":{"number":16,"created_at":"2011-10-14T21:33:06Z","pull_request":{"diff_url":"https://github.com/mattmueller/foursquare2/pull/16.diff","patch_url":"https://github.com/mattmueller/foursquare2/pull/16.patch","html_url":"https://github.com/mattmueller/foursquare2/pull/16"},"body":"I've made a few changes that see `return_error_or_body` raise an exception when an error from the FS API is returned. \r\n\r\nI don't think parsing the error from a Hash should be the responsibility of the library user, but something the library itself should do, so I wrote this patch to encapsulate any error data in an exception object for easy reporting and access by the user of the library.\r\n\r\nMaybe `return_error_or_body` should become `return_body_or_raise`, but I wanted to see what you thought of the pull request before I made any more changes. \r\n\r\nI'm using your library in a web app but when I get a foursquare API error, I cannot continue the rest of my method because it depends on foursquare data being present, so I'd prefer to fail hard and report the exception onto Airbrake(in this case), but I think my case would be a general one, where it is not possible to continue a method expecting FS API data without parsing the exception data and taking some alternative action.\r\n\r\nAny thoughts on this pull requests?\r\n\r\nBest,\r\nRob","comments":3,"title":"Encapsulate Foursquare API error data in a exception object.","updated_at":"2011-10-21T02:50:02Z","url":"https://api.github.com/repos/mattmueller/foursquare2/issues/16","id":1914357,"assignee":null,"milestone":null,"closed_at":"2011-10-20T13:40:25Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/22ca530c1db575f0a62b68c1900d8399?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"22ca530c1db575f0a62b68c1900d8399","url":"https://api.github.com/users/robgleeson","id":77573,"login":"robgleeson"},"html_url":"https://github.com/mattmueller/foursquare2/issues/16","labels":[],"state":"closed"},"legacy":{"issue_id":1914357,"comment_id":2477182}}