Class: GigaChat::MiddlewareErrors

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

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/gigachat.rb', line 14

def call(env)
  @app.call(env)
rescue Faraday::Error => e
  raise e unless e.response.is_a?(Hash)

  logger = Logger.new($stdout)
  logger.error(e.response[:body])

  raise e
end