Class: NxtSupport::Middleware::SentryErrorID
- Inherits:
-
Object
- Object
- NxtSupport::Middleware::SentryErrorID
- Defined in:
- lib/nxt_support/middleware/sentry_error_id.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ SentryErrorID
constructor
A new instance of SentryErrorID.
Constructor Details
#initialize(app) ⇒ SentryErrorID
Returns a new instance of SentryErrorID.
4 5 6 |
# File 'lib/nxt_support/middleware/sentry_error_id.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/nxt_support/middleware/sentry_error_id.rb', line 8 def call(env) status, headers, body = @app.call(env) if status && status.to_i >= 500 && env['sentry.error_event_id'] headers['Sentry-Error-Id'] = env['sentry.error_event_id'] exposed_headers = headers['Access-Control-Expose-Headers'] || headers['access-control-expose-headers'] headers['Access-Control-Expose-Headers'] = [exposed_headers, 'Sentry-Error-Id'].compact.join(', ') end [status, headers, body] end |