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.
551 552 553 554 555 556 |
# File 'lib/logbrew/rails_integration.rb', line 551 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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/logbrew/rails_integration.rb', line 558 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 |