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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 06:06:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 06:06:25 +0300
commit29c01c6c91558358c37ba45b03f240632bfb918d (patch)
treec6475afaf98ce740e8ba5fe227e7bd4a95b692cd /app/services/commits/create_service.rb
parenteed996ac33a60d5fd8315a62fec8beaa8e907e69 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/commits/create_service.rb')
-rw-r--r--app/services/commits/create_service.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/services/commits/create_service.rb b/app/services/commits/create_service.rb
index b5401a8ea37..b42494563b2 100644
--- a/app/services/commits/create_service.rb
+++ b/app/services/commits/create_service.rb
@@ -3,7 +3,15 @@
module Commits
class CreateService < ::BaseService
ValidationError = Class.new(StandardError)
- ChangeError = Class.new(StandardError)
+ class ChangeError < StandardError
+ attr_reader :error_code
+
+ def initialize(message, error_code = nil)
+ super(message)
+
+ @error_code = error_code
+ end
+ end
def initialize(*args)
super
@@ -21,8 +29,9 @@ module Commits
new_commit = create_commit!
success(result: new_commit)
+ rescue ChangeError => ex
+ error(ex.message, pass_back: { error_code: ex.error_code })
rescue ValidationError,
- ChangeError,
Gitlab::Git::Index::IndexError,
Gitlab::Git::CommitError,
Gitlab::Git::PreReceiveError,