diff options
author | Stan Hu <stanhu@gmail.com> | 2018-06-06 11:56:50 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-06-06 12:00:49 +0300 |
commit | 332275b766283ff65d0637ada3e4080c3cd4f038 (patch) | |
tree | 25ddd96287f3ea8eb26db54ea1d047acfa2a75ca /app/services/projects/create_service.rb | |
parent | 3a722ff53fe86ce6194f81ade810196f4f8e870c (diff) |
Simplify error message handling in Projects::CreateService
There's no need to add a redundant message to the errors if the
model is invalid. This cleans up the message as well for the importer.
Diffstat (limited to 'app/services/projects/create_service.rb')
-rw-r--r-- | app/services/projects/create_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index d16ecdb7b9b..d4a5b979f63 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -63,6 +63,7 @@ module Projects message = "Unable to save #{e.record.type}: #{e.record.errors.full_messages.join(", ")} " fail(error: message) rescue => e + @project.errors.add(:base, e.message) if @project fail(error: e.message) end @@ -141,7 +142,6 @@ module Projects Rails.logger.error(log_message) if @project - @project.errors.add(:base, message) @project.mark_import_as_failed(message) if @project.persisted? && @project.import? end |