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:
authorDouwe Maan <douwe@selenight.nl>2017-03-03 03:11:23 +0300
committerDouwe Maan <douwe@selenight.nl>2017-03-03 03:11:23 +0300
commitcaed61adeee1b5f1bf6943abd53e381ca31588c6 (patch)
treebca52ed45e49d5f4df0bfac65744f0067ebea61d /app/services/commits
parent6cc4cf1e151fb8da16796d7bbab16bc8a1ac08b6 (diff)
Use separate error class for cherry-pick and revert tree errors
Diffstat (limited to 'app/services/commits')
-rw-r--r--app/services/commits/change_service.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb
index 3051ebf5e52..3dcecee9365 100644
--- a/app/services/commits/change_service.rb
+++ b/app/services/commits/change_service.rb
@@ -37,14 +37,10 @@ module Commits
start_branch_name: @start_branch)
success
- rescue Repository::CommitError => e
- if e.message =~ /Failed to/
- error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically.
+ rescue Repository::CreateTreeError => e
+ error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically.
A #{action.to_s.dasherize} may have already been performed with this #{@commit.change_type_title(current_user)}, or a more recent commit may have updated some of its content."
- raise ChangeError, error_msg
- else
- raise
- end
+ raise ChangeError, error_msg
end
def check_push_permissions
@@ -58,8 +54,8 @@ module Commits
end
def validate_target_branch
- result = ValidateNewBranchService.new(@project, current_user).
- execute(@target_branch)
+ result = ValidateNewBranchService.new(@project, current_user)
+ .execute(@target_branch)
if result[:status] == :error
raise ChangeError, "There was an error creating the source branch: #{result[:message]}"