Class: LogBrew::Rails::ErrorReporter
- Inherits:
-
Object
- Object
- LogBrew::Rails::ErrorReporter
- Defined in:
- lib/logbrew/rails_integration.rb
Overview
Rails.error subscriber for handled reports. Unhandled errors stay owned by the request middleware so one exception cannot create two issues.
Constant Summary collapse
- CONTEXT_KEYS =
%w[controller action].freeze
Instance Method Summary collapse
-
#initialize(runtime) ⇒ ErrorReporter
constructor
A new instance of ErrorReporter.
- #report(error, handled: true, severity: :error, context: nil, source: nil, **options) ⇒ Object
Constructor Details
#initialize(runtime) ⇒ ErrorReporter
Returns a new instance of ErrorReporter.
818 819 820 821 822 823 |
# File 'lib/logbrew/rails_integration.rb', line 818 def initialize(runtime) @runtime = runtime @mutex = Mutex.new @subscriber_client = nil @subscriber = nil end |
Instance Method Details
#report(error, handled: true, severity: :error, context: nil, source: nil, **options) ⇒ Object
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/logbrew/rails_integration.rb', line 825 def report(error, handled: true, severity: :error, context: nil, source: nil, **) return nil unless handled active_client = @runtime.client return nil if active_client.nil? subscriber_for(active_client).report( error, handled: true, severity: severity, context: safe_context(context), source: bounded_source(source), ** ) rescue StandardError => capture_error @runtime.report_error("handled_error_capture", capture_error) nil end |