Class: SdrClient::Deposit::UnexpectedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/sdr_client/deposit/unexpected_response.rb

Overview

Handles unexpected responses when manipulating resources

Class Method Summary collapse

Class Method Details

.call(response) ⇒ Object

Parameters:

  • response (Faraday::Response)


8
9
10
11
12
13
# File 'lib/sdr_client/deposit/unexpected_response.rb', line 8

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