class Crashbreak::ExceptionNotifier

Public Instance Methods

notify() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 3
def notify
  RequestStore.store[:server_response] = exceptions_repository.create serialize_exception

  if created_error_is_unique?
    dump_system_and_update_report

    GithubIntegrationService.new(server_response).push_test if Crashbreak.configure.github_integration
  end
end

Private Instance Methods

created_error_is_unique?() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 45
def created_error_is_unique?
  !server_response['similar']
end
dump_system_and_update_report() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 15
def dump_system_and_update_report
  exceptions_repository.update server_response['id'], dumpers_data: dumpers_data
end
dumpers() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 33
def dumpers
  Crashbreak.configure.dumpers
end
dumpers_data() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 25
def dumpers_data
  {}.tap do |dupers_data_hash|
    dumpers.each do |dumper|
      dupers_data_hash[dumper.class.to_s] = dumper.dump
    end
  end
end
exceptions_repository() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 41
def exceptions_repository
  @exceptions_repository ||= ExceptionsRepository.new
end
serialize_exception() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 19
def serialize_exception
  {}.tap do |exception_hash|
    serializers.each { |serializer| exception_hash.deep_merge!(serializer.serialize) }
  end
end
serializers() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 37
def serializers
  [BasicInformationSerializer.new] + Crashbreak.configure.error_serializers
end
server_response() click to toggle source
# File lib/crashbreak/exception_notifier.rb, line 49
def server_response
  RequestStore.store[:server_response]
end