Class: Rollbar::Middleware::Rack
- Inherits:
-
Object
- Object
- Rollbar::Middleware::Rack
- Includes:
- ExceptionReporter, RequestDataExtractor
- Defined in:
- lib/rollbar/middleware/rack.rb,
lib/rollbar/middleware/rack/builder.rb,
lib/rollbar/middleware/rack/test_session.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Builder, TestSession
Constant Summary
Constants included from RequestDataExtractor
RequestDataExtractor::ALLOWED_BODY_PARSEABLE_METHODS, RequestDataExtractor::ALLOWED_HEADERS_REGEX
Instance Method Summary collapse
- #call(env) ⇒ Object
- #fetch_scope(env) ⇒ Object
- #framework_error(env) ⇒ Object
-
#initialize(app) ⇒ Rack
constructor
A new instance of Rack.
- #person_data_proc(env) ⇒ Object
Methods included from RequestDataExtractor
#extract_person_data_from_controller, #extract_request_data_from_rack, #scrub_params, #scrub_url
Methods included from ExceptionReporter
Constructor Details
#initialize(app) ⇒ Rack
Returns a new instance of Rack.
11 12 13 |
# File 'lib/rollbar/middleware/rack.rb', line 11 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rollbar/middleware/rack.rb', line 15 def call(env) .reset_notifier! .scoped(fetch_scope(env)) do begin response = @app.call(env) (env, framework_error(env)) if framework_error(env) response rescue Exception => e (env, e) raise end end end |
#fetch_scope(env) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/rollbar/middleware/rack.rb', line 30 def fetch_scope(env) { :request => proc { extract_request_data_from_rack(env) }, :person => person_data_proc(env) } rescue Exception => e (env, e) raise end |
#framework_error(env) ⇒ Object
44 45 46 |
# File 'lib/rollbar/middleware/rack.rb', line 44 def framework_error(env) nil end |
#person_data_proc(env) ⇒ Object
40 41 42 |
# File 'lib/rollbar/middleware/rack.rb', line 40 def person_data_proc(env) proc { extract_person_data_from_controller(env) } end |