Method: OData::Operation#check_response_errors

Defined in:
lib/odata/operation.rb

#check_response_errors(response) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/odata/operation.rb', line 20

def check_response_errors(response)
  # Check for Http error
  if response.code.to_i >= 400
    error_message = begin
      JSON.parse(response.body)['error']['message']
    rescue
      "An error occurred"
    end
    @ar.errors[:base] << "#{error_message} [http code #{response.code}]"
  end
end