Welcome to mirror list, hosted at ThFree Co, Russian Federation.

yaml.rb « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e3010ac3fdbbfd7db527f72fe004337f0e6d7a67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Yaml
        LoadError = Class.new(StandardError)

        class << self
          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
        end
      end
    end
  end
end