Class: Wildsight::Rack::BottomMiddleware
- Inherits:
-
Object
- Object
- Wildsight::Rack::BottomMiddleware
- Defined in:
- lib/wildsight/rack/bottom_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #extract(exception) ⇒ Object
-
#initialize(app) ⇒ BottomMiddleware
constructor
A new instance of BottomMiddleware.
Constructor Details
#initialize(app) ⇒ BottomMiddleware
Returns a new instance of BottomMiddleware.
6 7 8 |
# File 'lib/wildsight/rack/bottom_middleware.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/wildsight/rack/bottom_middleware.rb', line 10 def call(env) context = Wildsight::Rack.detect_context(env) response = context.profiler.duration(:rails) { @app.call(env) } return response rescue Exception => e context.event(:exception, extract(e)) raise e end |
#extract(exception) ⇒ Object
19 20 21 22 23 |
# File 'lib/wildsight/rack/bottom_middleware.rb', line 19 def extract(exception) data = {:message => exception., :name => exception.class.name, :backtrace => exception.backtrace} data[:cause] = extract_exception(exception.cause) if exception.cause return data end |