Method: Layer::Error.from_response
- Defined in:
- lib/layer/errors.rb
.from_response(response) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/layer/errors.rb', line 3 def self.from_response(response) status = response[:status] if klass = case status when 400 then Layer::Errors::BadRequest when 404 then Layer::Errors::NotFound when 409 then Layer::Errors::Conflict when 410 then Layer::Errors::ResourceDeleted when 500..599 then Layer::Errors::ServerError else self end klass.new(response) end end |