mbbx6spp / twitter4r

OLD repository: Please see http://github.com/twitter4r/twitter4r-core for latest official repository for project.Twitter4R: The most Ruby-like bindings for the Twitter.com REST API by a long way. (Anyone want to take over? I don't have time for Ruby OSS projects any more)
http://github.com/twitter4r/twitter4r-core
MIT License
89 stars 9 forks source link

Add Twitter::RESTError class hierarchy #2

Open mbbx6spp opened 15 years ago

mbbx6spp commented 15 years ago

So that developers can use different rescue blocks (instead of a case statement within a rescue block) to know how to process the exception.

Exception subclasses of @Twitter::RESTError@ should include: @Twitter::ForbiddenRESTError@ for 401 HTTP responses @Twitter::UnauthorizedRESTError@ for 403 HTTP responses @Twitter::ServerRESTError@ for 500 HTTP responses @Twitter::UnavailableRESTError@ for 503 HTTP responses

I should also add the following convenience method on @Twitter::RESTError@: *@.from_status_code(status_code)@ which will return the corresponding exception class for the given @status_code@. e.g. @Twitter::RESTError.from_status_code(500)@ will return @Twitter::ServerRESTError@.