Class: Cocina::Models::Mapping::ErrorNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/mapping/error_notifier.rb

Overview

Notifies when a data error is encountered. Notification is performed with Honeybadger.

Instance Method Summary collapse

Constructor Details

#initialize(druid:) ⇒ ErrorNotifier

Returns a new instance of ErrorNotifier.

Parameters:

  • druid (String)


12
13
14
# File 'lib/cocina/models/mapping/error_notifier.rb', line 12

def initialize(druid:)
  @druid = druid
end

Instance Method Details

#error(message, _context = {}) ⇒ Object

Notify for a critical data error.

Parameters:

  • message (String)
  • context (Hash<String, String>)

    to add to error context



26
27
28
# File 'lib/cocina/models/mapping/error_notifier.rb', line 26

def error(message, _context = {})
  Kernel.warn "[ERROR] #{message}"
end

#warn(message, _context = {}) ⇒ Object

Notify for a non-critical data error.

Parameters:

  • message (String)
  • context (Hash<String, String>)

    to add to warning context



19
20
21
# File 'lib/cocina/models/mapping/error_notifier.rb', line 19

def warn(message, _context = {})
  Kernel.warn "[WARN] #{message}"
end