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.
624 625 626 627 628 629 |
# File 'lib/logbrew/rails_integration.rb', line 624 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
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
# File 'lib/logbrew/rails_integration.rb', line 631 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 |