Class: Middleware::Authentication

Inherits:
Restforce::Middleware
  • Object
show all
Defined in:
lib/restforce/extensions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#error_message(response) ⇒ Object

Internal: Get an error message for the passed response. Overrides the default behavior of the middleware to correctly handle broken responses from Faraday.

Returns a String.



11
12
13
14
15
16
17
# File 'lib/restforce/extensions.rb', line 11

def error_message(response)
  if response.status == 0
    "Request was closed prematurely"
  else
    "#{response.body['error']}: #{response.body['error_description']}"
  end
end