Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-06-06 11:56:50 +0300
committerStan Hu <stanhu@gmail.com>2018-06-06 12:00:49 +0300
commit332275b766283ff65d0637ada3e4080c3cd4f038 (patch)
tree25ddd96287f3ea8eb26db54ea1d047acfa2a75ca /app/services
parent3a722ff53fe86ce6194f81ade810196f4f8e870c (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')
-rw-r--r--app/services/projects/create_service.rb2
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