Class: Sentry::Rails::RescuedExceptionInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/rails/rescued_exception_interceptor.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RescuedExceptionInterceptor

Returns a new instance of RescuedExceptionInterceptor.



6
7
8
# File 'lib/sentry/rails/rescued_exception_interceptor.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/sentry/rails/rescued_exception_interceptor.rb', line 10

def call(env)
  return @app.call(env) unless Sentry.initialized?

  begin
    @app.call(env)
  rescue => e
    env["sentry.rescued_exception"] = e if report_rescued_exceptions?
    raise e
  end
end

#report_rescued_exceptions?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sentry/rails/rescued_exception_interceptor.rb', line 21

def report_rescued_exceptions?
  Sentry.configuration.rails.report_rescued_exceptions
end