# frozen_string_literal: true

class UniformNotifier
  class HoneybadgerNotifier < Base
    def self.active?
      !!UniformNotifier.honeybadger
    end

    protected

    def self._out_of_channel_notify(data)
      message = data.values.compact.join("\n")

      opt = {}
      opt = UniformNotifier.honeybadger if UniformNotifier.honeybadger.is_a?(Hash)

      exception = Exception.new(message)
      honeybadger_class = opt[:honeybadger_class] || Honeybadger
      honeybadger_class.notify(exception, opt)
    end
  end
end
