Class: Apruve::FaradayErrorHandler Private

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/apruve/faraday_error_handler.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/apruve/faraday_error_handler.rb', line 4

def call(env)
  begin
    @app.call(env)
  rescue Faraday::ConnectionFailed
    raise Apruve::ServiceUnreachable.new
    rescue Faraday::ParsingError
      raise Apruve::ResponseUnreadable.new
    rescue Faraday::ClientError
      raise Apruve::UnknownError.new
  end
end