Class: MaisOrcidClient::UnexpectedResponse
- Inherits:
-
Object
- Object
- MaisOrcidClient::UnexpectedResponse
- Defined in:
- lib/mais_orcid_client/unexpected_response.rb
Overview
Handles unexpected responses when communicating with Mais
Defined Under Namespace
Classes: ResponseError, ServerError, UnauthorizedError
Class Method Summary collapse
Class Method Details
.call(response) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mais_orcid_client/unexpected_response.rb', line 15 def self.call(response) case response.status when 401 raise UnauthorizedError, "There was a problem with the access token: #{response.body}" when 500 raise ServerError, "Mais server error: #{response.body}" else raise StandardError, "Unexpected response: #{response.status} #{response.body}" end end |