Class: ScoutApm::ErrorService::Middleware
- Inherits:
-
Object
- Object
- ScoutApm::ErrorService::Middleware
- Defined in:
- lib/scout_apm/error_service/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
4 5 6 |
# File 'lib/scout_apm/error_service/middleware.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/scout_apm/error_service/middleware.rb', line 8 def call(env) begin response = @app.call(env) rescue Exception => exception context = ScoutApm::Agent.instance.context context.logger.debug "[Scout Error Service] Caught Exception: #{exception.class.name}" # Bail out early, and reraise if the error is not interesting. if context.ignored_exceptions.ignored?(exception) raise end # Capture the error for further processing and shipping context.error_buffer.capture(exception, env) # Finally re-raise raise end response end |