Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #70 from curationexperts/more_robust_error_reporting
Browse files Browse the repository at this point in the history
Do not fail to record an error if title is missing
  • Loading branch information
little9 authored Feb 21, 2019
2 parents 2b9cba7 + 5714499 commit e8c4d77
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
bixby: bixby_default.yml

Expand Down
21 changes: 21 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-02-21 09:32:03 -0500 using RuboCop version 0.52.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Metrics/CyclomaticComplexity:
Max: 7

# Offense count: 1
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 228

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 8
3 changes: 2 additions & 1 deletion lib/darlingtonia/hyrax_record_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def create_for(record:)
uploaded_files: create_upload_files(record),
depositor: @depositor.user_key
}

created = import_type.new

attrs = record.attributes.merge(additional_attrs)
Expand All @@ -177,7 +178,7 @@ def create_for(record:)
@success_count += 1
else
created.errors.each do |attr, msg|
error_stream << "event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: #{attrs[:title].first}"
error_stream << "event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}"
end
@failure_count += 1
end
Expand Down

0 comments on commit e8c4d77

Please sign in to comment.