Class: Rollbar::Middleware::Sinatra
Constant Summary
RequestDataExtractor::ALLOWED_HEADERS_REGEX
Instance Method Summary
collapse
#extract_person_data_from_controller, #extract_request_data_from_rack, #scrub_params, #scrub_url
#report_exception_to_rollbar
Constructor Details
#initialize(app) ⇒ Sinatra
Returns a new instance of Sinatra.
11
12
13
|
# File 'lib/rollbar/middleware/sinatra.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/sinatra.rb', line 15
def call(env)
Rollbar.reset_notifier!
Rollbar.scoped(fetch_scope(env)) do
begin
response = @app.call(env)
report_exception_to_rollbar(env, framework_error(env)) if framework_error(env)
response
rescue Exception => e
report_exception_to_rollbar(env, e)
raise
end
end
end
|
#fetch_scope(env) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/rollbar/middleware/sinatra.rb', line 30
def fetch_scope(env)
{
:request => proc { (env) },
:person => person_data_proc(env)
}
rescue Exception => e
report_exception_to_rollbar(env, e)
raise
end
|
#framework_error(env) ⇒ Object
44
45
46
|
# File 'lib/rollbar/middleware/sinatra.rb', line 44
def framework_error(env)
env['sinatra.error']
end
|
#person_data_proc(env) ⇒ Object
40
41
42
|
# File 'lib/rollbar/middleware/sinatra.rb', line 40
def person_data_proc(env)
proc { (env) }
end
|