Class: Johac::Connection::Middleware::Exceptions

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/johac/connection.rb

Overview

Will raise some Error::ConnectionError if something happens with the connection.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/johac/connection.rb', line 184

def call(env)
  @app.call(env)
rescue Faraday::Error::ConnectionFailed => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error::ResourceNotFound => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error::ParsingError => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error::TimeoutError => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error::SSLError => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error::ClientError => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Faraday::Error => e
  raise ::Johac::Error::ConnectionError, e.message
rescue Net::HTTP::Persistent::Error => e
  raise ::Johac::Error::ConnectionError, e.message, e.backtrace
end