Sha256: d4975eb6760990d63fbb3e1d1a44c30bf1d8237764448e00e989dfc4de1550f2
Contents?: true
Size: 935 Bytes
Versions: 3
Compression:
Stored size: 935 Bytes
Contents
# frozen_string_literal: true class FolioClient # Handles unexpected responses when communicating with Folio class UnexpectedResponse # @param [Faraday::Response] response def self.call(response) case response.status when 401 raise UnauthorizedError, "There was a problem with the access token: #{response.body}" when 403 raise ForbiddenError, "The operation requires privileges which the client does not have: #{response.body}" when 404 raise ResourceNotFound, "Endpoint not found or resource does not exist: #{response.body}" when 422 raise ValidationError, "There was a validation problem with the request: #{response.body} " when 500 raise ServiceUnavailable, "The remote server returned an internal server error." else raise StandardError, "Unexpected response: #{response.status} #{response.body}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
folio_client-0.10.0 | lib/folio_client/unexpected_response.rb |
folio_client-0.9.0 | lib/folio_client/unexpected_response.rb |
folio_client-0.8.0 | lib/folio_client/unexpected_response.rb |