Sha256: f7296d8232e5bcc5cd12716e7acad18df42b05a353025762ba2cacef20b40033

Contents?: true

Size: 541 Bytes

Versions: 30

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

module SdrClient
  module Deposit
    # Handles unexpected responses when manipulating resources
    class UnexpectedResponse
      # @param [Faraday::Response] response
      def self.call(response)
        raise "There was an error with your request: #{response.body}" if response.status == 400
        raise 'There was an error with your credentials. Perhaps they have expired?' if response.status == 401

        raise "unexpected response: #{response.status} #{response.body}"
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
sdr-client-0.61.1 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.61.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.60.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.59.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.58.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.57.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.56.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.55.1 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.55.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.54.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.53.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.52.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.51.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.51.0.beta.1 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.50.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.49.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.48.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.47.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.46.0 lib/sdr_client/deposit/unexpected_response.rb
sdr-client-0.45.0 lib/sdr_client/deposit/unexpected_response.rb