mattmueller/foursquare2 — pull request #16 by robgleeson (2011-10-14 21:33:06+00:00)
Title: Encapsulate Foursquare API error data in a exception object.

I've made a few changes that see `return_error_or_body` raise an exception when an error from the FS API is returned.

I 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.

Maybe `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.

I'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.

Any thoughts on this pull requests?

Best,
Rob