Skip to content

Commit

Permalink
Return data prep errors early
Browse files Browse the repository at this point in the history
  • Loading branch information
kspurgin committed Feb 11, 2024
1 parent 9587bed commit 1fac900
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/collectionspace/mapper/date_details/data_prepper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def prep
if handler.grouped_handler
extract_grouped_data
grouped_prepped = handler.grouped_handler.prep(grouped_data)
unless grouped_prepped.errors.empty?
grouped_prepped.errors.each { |err| response.add_error(err) }
return response
end
end
split_data
transform_data
Expand All @@ -42,6 +46,8 @@ def prep
clean_transformed
readd_id
combine_data_fields
return response unless response.errors.empty?

merge_authority_data(auth_prepped) if authority_data
merge_grouped_data(grouped_prepped) if grouped_data
response
Expand Down Expand Up @@ -209,9 +215,10 @@ def merge_authority_data(auth_prepped)
def merge_grouped_data(grouped_prepped)
path = handler.target_path

response.combined_data[path].merge!(
grouped_prepped.combined_data[path]
)
response.combined_data[path].tap { |data| binding.pry unless data }
.merge!(
grouped_prepped.combined_data[path]
)
grouped_prepped.errors.each { |err| response.add_error(err) }
grouped_prepped.terms.each { |term| response.add_term(term) }
grouped_prepped.warnings.each do |warning|
Expand Down

0 comments on commit 1fac900

Please sign in to comment.