Skip to content

Gracefully handle Date::Error when parsing Date

rfb11 requested to merge datacite-date-parsing-hotfix into main

Should prevent:

rails aborted!
Date::Error: invalid date
/opt/app-root/app/services/datacite_metadata.rb:76:in `parse'
/opt/app-root/app/services/datacite_metadata.rb:76:in `set_publication_year'
/opt/app-root/app/services/datacite_metadata.rb:21:in `call'
/opt/app-root/app/services/datacite_metadata.rb:7:in `call'
/opt/app-root/app/services/datacite_registration.rb:6:in `datacite_request_body'
/opt/app-root/app/services/datacite_registration.rb:18:in `call'
/opt/app-root/app/services/datacite_registration.rb:34:in `block in mint_dois_for_datasets'
/opt/app-root/app/services/datacite_registration.rb:32:in `each'
/opt/app-root/app/services/datacite_registration.rb:32:in `mint_dois_for_datasets'
/opt/app-root/app/services/datacite_registration.rb:52:in `mint_missing_dois'
/opt/app-root/lib/tasks/rdr.rake:35:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/railties-5.2.8.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/bundle/gems/railties-5.2.8.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-5.2.8.1/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-5.2.8.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:11:in `require'
bin/rails:11:in `<main>'
Tasks: TOP => rdr:mint_missing_dois
(See full trace by running task with --trace)
ERROR: 1

Merge request reports