Commit 2243f0e3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add IncludeError exception and use it in CI config

parent 5f502c3a
...@@ -13,10 +13,10 @@ module Gitlab ...@@ -13,10 +13,10 @@ module Gitlab
@global = Entry::Global.new(@config) @global = Entry::Global.new(@config)
@global.compose! @global.compose!
rescue Loader::FormatError, Extendable::ExtensionError => e rescue Loader::FormatError,
Extendable::ExtensionError,
External::Processor::IncludeError => e
raise Config::ConfigError, e.message raise Config::ConfigError, e.message
rescue External::Processor::FileError => e
raise ::Gitlab::Ci::YamlProcessor::ValidationError, e.message
end end
def valid? def valid?
......
...@@ -5,7 +5,8 @@ module Gitlab ...@@ -5,7 +5,8 @@ module Gitlab
class Config class Config
module External module External
class Processor class Processor
FileError = Class.new(StandardError) IncludeError = Class.new(StandardError)
FileError = Class.new(IncludeError)
def initialize(values, project, sha) def initialize(values, project, sha)
@values = values @values = values
......
...@@ -200,7 +200,7 @@ describe Gitlab::Ci::Config do ...@@ -200,7 +200,7 @@ describe Gitlab::Ci::Config do
it 'raises error YamlProcessor validationError' do it 'raises error YamlProcessor validationError' do
expect { config }.to raise_error( expect { config }.to raise_error(
::Gitlab::Ci::YamlProcessor::ValidationError, described_class::ConfigError,
"Local file 'invalid' is not valid." "Local file 'invalid' is not valid."
) )
end end
......
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