class FakeServiceBus::CatchErrors

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/fake_servicebus/catch_errors.rb, line 6
def initialize(app, options = {})
  @app = app
  @response = options.fetch(:response)
end

Public Instance Methods

call(env) click to toggle source
# File lib/fake_servicebus/catch_errors.rb, line 11
def call(env)
  @app.call(env)
rescue => error
  response = @response.new(error)
  [ response.status, {}, [ response.body ] ]
end