Class: FakeSQS::CatchErrors
- Inherits:
-
Object
- Object
- FakeSQS::CatchErrors
- Defined in:
- lib/fake_sqs/catch_errors.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ CatchErrors
constructor
A new instance of CatchErrors.
Constructor Details
#initialize(app, options = {}) ⇒ CatchErrors
Returns a new instance of CatchErrors.
6 7 8 9 |
# File 'lib/fake_sqs/catch_errors.rb', line 6 def initialize(app, = {}) @app = app @response = .fetch(:response) end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fake_sqs/catch_errors.rb', line 11 def call(env) @app.call(env) rescue => error response = @response.new(error) [ response.status, {}, [ response.body ] ] end |