Exception: YouCanBookMe::Error
- Inherits:
-
StandardError
- Object
- StandardError
- YouCanBookMe::Error
- Defined in:
- lib/YouCanBookMe/client/error.rb
Direct Known Subclasses
AuthorizationNotSpecified, ClientError, ServerError, UnknownError
Class Method Summary collapse
Class Method Details
.raise_from(response) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/YouCanBookMe/client/error.rb', line 6 def raise_from(response) status = response.code return if (200..299).cover?(status) klass = case status when 400 then YouCanBookMe::BadRequest when 400..499 then YouCanBookMe::ClientError when 500 then YouCanBookMe::InternalServerError when 500..599 then YouCanBookMe::ServerError else YouCanBookMe::UnknownError end # FIXME raise klass, response.code end |