Module: GetaroundUtils::Utils::HandleError

Extended by:
Mixins::Loggable
Defined in:
lib/getaround_utils/utils/handle_error.rb

Constant Summary

Constants included from Mixins::Loggable

Mixins::Loggable::MONITORABLE_LOG_PREFIX

Class Method Summary collapse

Methods included from Mixins::Loggable

base_append_infos_to_loggable, loggable_class_name, loggable_log, loggable_logger, loggable_logger_fallback, monitorable_log, monitorable_log_message, monitorable_threshold

Class Method Details

.notify_of(error, **metadata) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/getaround_utils/utils/handle_error.rb', line 13

def self.notify_of(error, **, &)
  if defined?(::Bugsnag)
    ::Bugsnag.notify(error) do |event|
      .each do |name, value|
        if value.is_a?(Hash)
          event.(name, value)
        else
          event.('custom', name, value)
        end
      end
      yield event if block_given?
    end
  else
    loggable_log(
      :debug,
      'handled_error',
      error_class: error.class.name,
      error_message: error.to_s,
      **
    )
  end
end