Class: Airbrake::UserInformer::Middleware
- Inherits:
-
Object
- Object
- Airbrake::UserInformer::Middleware
- Defined in:
- lib/airbrake/user_informer.rb
Overview
Constant Summary collapse
- ENV_KEY =
"airbrake.promise"
- TIMEOUT =
seconds
1.0
- STEPS =
100
- DEFAULT_PLACEHOLDER =
"<!-- AIRBRAKE ERROR -->"
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.
28 29 30 |
# File 'lib/airbrake/user_informer.rb', line 28 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/airbrake/user_informer.rb', line 32 def call(env) status, headers, body = @app.call(env) if (replacement = Airbrake.user_information) && error_id = wait_for_error(env[ENV_KEY]) replacement = replacement.gsub(/\{\{\s*error_id\s*\}\}/, error_id.to_s) body = replace_placeholder(replacement, body, headers) headers["Error-Id"] = error_id.to_s end [status, headers, body] end |