Add IncludeError exception and use it in CI config

This commit is contained in:
Grzegorz Bizon 2018-10-18 11:06:32 +02:00
parent 5f502c3a82
commit 2243f0e3de
3 changed files with 6 additions and 5 deletions

View file

@ -13,10 +13,10 @@ module Gitlab
@global = Entry::Global.new(@config)
@global.compose!
rescue Loader::FormatError, Extendable::ExtensionError => e
rescue Loader::FormatError,
Extendable::ExtensionError,
External::Processor::IncludeError => e
raise Config::ConfigError, e.message
rescue External::Processor::FileError => e
raise ::Gitlab::Ci::YamlProcessor::ValidationError, e.message
end
def valid?

View file

@ -5,7 +5,8 @@ module Gitlab
class Config
module External
class Processor
FileError = Class.new(StandardError)
IncludeError = Class.new(StandardError)
FileError = Class.new(IncludeError)
def initialize(values, project, sha)
@values = values

View file

@ -200,7 +200,7 @@ describe Gitlab::Ci::Config do
it 'raises error YamlProcessor validationError' do
expect { config }.to raise_error(
::Gitlab::Ci::YamlProcessor::ValidationError,
described_class::ConfigError,
"Local file 'invalid' is not valid."
)
end