Browse Source

Add better validation error logging to lettings import service (#1355)

pull/1359/head
James Rose 2 years ago committed by GitHub
parent
commit
4b17ab94df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/services/imports/lettings_logs_import_service.rb

9
app/services/imports/lettings_logs_import_service.rb

@ -289,6 +289,15 @@ module Imports
save_lettings_log(attributes, previous_status)
else
@logger.error("Log #{lettings_log.old_id}: Failed to import")
lettings_log.errors.each do |error|
@logger.error("Validation error: Field #{error.attribute}:")
@logger.error("\tOwning Organisation: #{lettings_log.owning_organisation&.name}")
@logger.error("\tManaging Organisation: #{lettings_log.managing_organisation&.name}")
@logger.error("\tOld CORE ID: #{lettings_log.old_id}")
@logger.error("\tOld CORE: #{attributes[error.attribute.to_s]&.inspect}")
@logger.error("\tNew CORE: #{lettings_log.read_attribute(error.attribute)&.inspect}")
@logger.error("\tError message: #{error.type}")
end
raise exception
end
end

Loading…
Cancel
Save