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:
Diffstat (limited to 'lib/gitlab/ci/config/yaml.rb')
-rw-r--r--lib/gitlab/ci/config/yaml.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/gitlab/ci/config/yaml.rb b/lib/gitlab/ci/config/yaml.rb
index f74ef95a832..e3010ac3fdb 100644
--- a/lib/gitlab/ci/config/yaml.rb
+++ b/lib/gitlab/ci/config/yaml.rb
@@ -4,21 +4,17 @@ module Gitlab
module Ci
class Config
module Yaml
+ LoadError = Class.new(StandardError)
+
class << self
- def load!(content, project: nil)
- Loader.new(content, project: project).to_result.then do |result|
- ##
- # raise an error for backwards compatibility
- #
- raise result.error unless result.valid?
+ def load!(content, current_user: nil)
+ Loader.new(content, current_user: current_user).load.then do |result|
+ raise result.error_class, result.error if !result.valid? && result.error_class.present?
+ raise LoadError, result.error unless result.valid?
result.content
end
end
-
- def load_result!(content, project: nil)
- Loader.new(content, project: project).to_result
- end
end
end
end