Class: AirbrakeAPI::Middleware::RaiseResponseError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/airbrake-api/middleware/raise_response_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object

Raises:


7
8
9
10
11
12
13
# File 'lib/airbrake-api/middleware/raise_response_error.rb', line 7

def on_complete(env)
  raise AirbrakeError.new('No results found.') if env[:body].nil?

  if env[:body].errors && env[:body].errors.error
    raise AirbrakeError.new(env[:body].errors.error)
  end
end