class Simplewoo::Connection::ErrorMiddleware

Middleware for responding to Errors returned from the api

Public Class Methods

new(app) click to toggle source
# File lib/simplewoo/connection.rb, line 69
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/simplewoo/connection.rb, line 73
def call(env)
  @app.call(env).on_complete do |env|
    if error = Simplewoo::Error.from(env[:response])
      raise error
    end
  end
end