Class: SdrClient::RedesignedClient::UnexpectedResponse
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::UnexpectedResponse
- Defined in:
- lib/sdr_client/redesigned_client/unexpected_response.rb
Overview
Handles unexpected responses
Defined Under Namespace
Classes: BadRequest, Unauthorized
Class Method Summary collapse
Class Method Details
.call(response) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sdr_client/redesigned_client/unexpected_response.rb', line 13 def self.call(response) case response.status when 400 raise BadRequest, "There was an error with your request: #{response.body}" when 401 raise Unauthorized, 'There was an error with your credentials.' else raise "unexpected response: #{response.status} #{response.body}" end end |