Class: BrainzLab::Rails::ErrorSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/brainzlab/rails/railtie.rb

Overview

Rails 7+ ErrorReporter subscriber

Instance Method Summary collapse

Instance Method Details

#report(error, handled:, severity:, context: {}, source: nil) ⇒ Object



428
429
430
431
432
433
434
435
436
437
# File 'lib/brainzlab/rails/railtie.rb', line 428

def report(error, handled:, severity:, context: {}, source: nil)
  # Capture both handled and unhandled, but mark them
  BrainzLab::Reflex.capture(error,
                            handled: handled,
                            severity: severity.to_s,
                            source: source,
                            extra: context)
rescue StandardError => e
  BrainzLab.configuration.logger&.error("[BrainzLab] ErrorSubscriber failed: #{e.message}")
end