class YouCanBookMe::Error

Public Class Methods

raise_from(response) click to toggle source
# 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