Commit 7139d248 authored by Robert Speicher's avatar Robert Speicher

Add support for create_tree_error_code from Gitaly

Available in Gitaly 1.70, this additional field on `CreateTreeError`
provides context about why a cherry-pick or revert failed.

This adds an `error_code` attribute to
`Gitlab::Git::Repository::CreateTreeError`.
parent 2a224c88
......@@ -23,7 +23,7 @@ module Commits
message,
start_project: @start_project,
start_branch_name: @start_branch)
rescue Gitlab::Git::Repository::CreateTreeError
rescue Gitlab::Git::Repository::CreateTreeError => ex
act = action.to_s.dasherize
type = @commit.change_type_title(current_user)
......
......@@ -25,9 +25,17 @@ module Gitlab
InvalidRef = Class.new(StandardError)
GitError = Class.new(StandardError)
DeleteBranchError = Class.new(StandardError)
CreateTreeError = Class.new(StandardError)
TagExistsError = Class.new(StandardError)
ChecksumError = Class.new(StandardError)
class CreateTreeError < StandardError
attr_reader :error_code
def initialize(error_code)
super(self.class.name)
@error_code = error_code.downcase.to_sym
end
end
# Directory name of repo
attr_reader :name
......
......@@ -447,7 +447,7 @@ module Gitlab
elsif response.commit_error.presence
raise Gitlab::Git::CommitError, response.commit_error
elsif response.create_tree_error.presence
raise Gitlab::Git::Repository::CreateTreeError, response.create_tree_error
raise Gitlab::Git::Repository::CreateTreeError, response.create_tree_error_code
end
Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment