Class: PactBroker::Errors::ErrorReporter

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/pact_broker/errors/error_reporter.rb

Instance Method Summary collapse

Methods included from Logging

included, #log_error, #log_with_tag, #measure_info

Constructor Details

#initialize(api_error_reporters) ⇒ ErrorReporter

Returns a new instance of ErrorReporter.



9
10
11
# File 'lib/pact_broker/errors/error_reporter.rb', line 9

def initialize(api_error_reporters)
  @api_error_reporters = api_error_reporters
end

Instance Method Details

#call(error, error_reference, env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pact_broker/errors/error_reporter.rb', line 13

def call error, error_reference, env
  if PactBroker::Errors.reportable_error?(error)
    api_error_reporters.each do | error_reporter |
      begin
        error_reporter.call(error, env: env, error_reference: error_reference)
      rescue StandardError => e
        log_error(e, "Error executing api_error_reporter")
      end
    end
  end
end