Class: Bugwatch::ErrorSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/bugwatch/error_subscriber.rb

Instance Method Summary collapse

Instance Method Details

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



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/bugwatch/error_subscriber.rb', line 3

def report(error, handled:, severity:, context: {}, source: nil)
  return if Bugwatch.configuration.ignore?(error)
  return unless Bugwatch.configuration.notify_for_release_stage?

  payload = ErrorBuilder.new(error).build
  payload[:context] = context.merge(
    handled: handled,
    severity: severity,
    source: source
  ).compact

  Notification.new(payload).deliver
end