Class: TrelloFlow::Api::ErrorHandler

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/trello_flow/api/error_handler.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/trello_flow/api/error_handler.rb', line 6

def call(env)
  @app.call(env).on_complete do
    if !env.success?
      raise Error, env[:body]
    end
  end
end