class XRay::Rails::ExceptionMiddleware
Middleware for capturing unhandled exceptions from views/controller. To properly capture exceptions this middleware needs to be placed after the default exception handling middleware. Otherwise they will be swallowed.
Public Class Methods
new(app, recorder: nil)
click to toggle source
# File lib/aws-xray-sdk/facets/rails/ex_middleware.rb, line 10 def initialize(app, recorder: nil) @app = app @recorder = recorder || XRay.recorder end
Public Instance Methods
call(env)
click to toggle source
# File lib/aws-xray-sdk/facets/rails/ex_middleware.rb, line 15 def call(env) @app.call(env) rescue Exception => e segment = @recorder.current_segment segment.add_exception exception: e if segment raise e end