diff --git a/CHANGELOG.md b/CHANGELOG.md index 17892fc9..bb0bb1fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This project bumps the version number for any changes (including documentation u ## [Unreleased] - i.e. pushed to main branch but not yet tagged as a release +## [5.0.6] - 2024-02-11 +- Return date details responses early if there are errors, to avoid exceptions + ## [5.0.5] - 2024-02-02 - For `date details` batch mode: add support for ingesting grouped fields at the same level as the structured date group. To find the group level of the structured date group, find the `date_field_group` value in the relevant CSV ingest template. If that field has a `REPEATING FIELD GROUP` value in the template, any other field values with the same `REPEATING FIELD GROUP` value can be ingested together. diff --git a/Gemfile.lock b/Gemfile.lock index 94017908..222bf3c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GIT PATH remote: . specs: - collectionspace-mapper (5.0.5) + collectionspace-mapper (5.0.6) activesupport (= 7.0.4.3) chronic collectionspace-client (~> 0.15.0) diff --git a/lib/collectionspace/mapper/date_details/data_prepper.rb b/lib/collectionspace/mapper/date_details/data_prepper.rb index df30d6a8..0b7bc160 100644 --- a/lib/collectionspace/mapper/date_details/data_prepper.rb +++ b/lib/collectionspace/mapper/date_details/data_prepper.rb @@ -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 @@ -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 @@ -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| diff --git a/lib/collectionspace/mapper/version.rb b/lib/collectionspace/mapper/version.rb index 92884506..8f24b748 100644 --- a/lib/collectionspace/mapper/version.rb +++ b/lib/collectionspace/mapper/version.rb @@ -2,6 +2,6 @@ module CollectionSpace module Mapper - VERSION = "5.0.5" + VERSION = "5.0.6" end end