Class: Bigcommerce::Middleware::HttpException

Inherits:
Faraday::Middleware
  • Object
show all
Includes:
HttpErrors
Defined in:
lib/bigcommerce/middleware/http_exception.rb

Constant Summary

Constants included from HttpErrors

HttpErrors::ERRORS, HttpErrors::X_RETRY_AFTER_HEADER_KEY

Instance Method Summary collapse

Methods included from HttpErrors

#throw_http_exception!

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
# File 'lib/bigcommerce/middleware/http_exception.rb', line 10

def call(env)
  @app.call(env).on_complete do |response_env|
    on_complete(response_env)
  end
end

#on_complete(env) ⇒ Object



16
17
18
19
# File 'lib/bigcommerce/middleware/http_exception.rb', line 16

def on_complete(env)
  throw_http_exception! env[:status].to_i, env
  env
end