summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-11-06 23:18:32 -0500
committerRobert Speicher <rspeicher@gmail.com>2018-11-08 15:59:55 +0000
commitcc12b57c3ff6a46583abecc76e366e59426cf14c (patch)
tree99789b3885771597a71987abc62a63768ed37c46
parent2a450e2180fcb8c374b506c202a0acd6a2cc3e2f (diff)
downloadgitlab-ce-cc12b57c3ff6a46583abecc76e366e59426cf14c.tar.gz
Correct error message returned by ChangeService
Previously the string was spanning multiple lines and included a needless `\n` character in the resulting error message. This change also reduces duplication by assigning two variables.
-rw-r--r--app/services/commits/change_service.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb
index 2fbd442fc2e..fbf71f02837 100644
--- a/app/services/commits/change_service.rb
+++ b/app/services/commits/change_service.rb
@@ -24,8 +24,12 @@ module Commits
start_project: @start_project,
start_branch_name: @start_branch)
rescue Gitlab::Git::Repository::CreateTreeError
- error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically.
- This #{@commit.change_type_title(current_user)} may already have been #{action.to_s.dasherize}ed, or a more recent commit may have updated some of its content."
+ act = action.to_s.dasherize
+ type = @commit.change_type_title(current_user)
+
+ error_msg = "Sorry, we cannot #{act} this #{type} automatically. " \
+ "This #{type} may already have been #{act}ed, or a more recent " \
+ "commit may have updated some of its content."
raise ChangeError, error_msg
end
end