Module: Rollbar::ExceptionReporter
- Included in:
- Middleware::Rack, Middleware::Rack::Builder, Middleware::Rack::TestSession, Middleware::Rails::RollbarMiddleware, Middleware::Rails::ShowExceptions
- Defined in:
- lib/rollbar/exception_reporter.rb
Overview
:nodoc:
Instance Method Summary collapse
- #capture_uncaught? ⇒ Boolean
- #exception_data(exception) ⇒ Object
- #log_exception_message(exception) ⇒ Object
- #report_exception_to_rollbar(env, exception) ⇒ Object
Instance Method Details
#capture_uncaught? ⇒ Boolean
29 30 31 32 |
# File 'lib/rollbar/exception_reporter.rb', line 29 def capture_uncaught? Rollbar.configuration.capture_uncaught != false && !Rollbar.configuration.enable_rails_error_subscriber end |
#exception_data(exception) ⇒ Object
40 41 42 43 |
# File 'lib/rollbar/exception_reporter.rb', line 40 def exception_data(exception) Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception, :use_exception_level_filters => true) end |
#log_exception_message(exception) ⇒ Object
34 35 36 37 38 |
# File 'lib/rollbar/exception_reporter.rb', line 34 def (exception) = exception. if exception.respond_to?(:message) ||= 'No Exception Message' Rollbar.log_debug "[Rollbar] Reporting exception: #{}" end |
#report_exception_to_rollbar(env, exception) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rollbar/exception_reporter.rb', line 3 def (env, exception) return unless capture_uncaught? (exception) exception_data = exception_data(exception) case exception_data when Hash env['rollbar.exception_uuid'] = exception_data[:uuid] Rollbar.log_debug( "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}" ) when 'disabled' Rollbar.log_debug( '[Rollbar] Exception not reported because Rollbar is disabled' ) when 'ignored' Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored' end rescue StandardError => e Rollbar.log_warning( "[Rollbar] Exception while reporting exception to Rollbar: #{e.}" ) end |