summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-18 11:06:32 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-18 11:07:32 +0200
commit2243f0e3deaf0c9557fdc971e566b5606e9e9c52 (patch)
treed30305d5491849830b5153828f518f2701c9a774
parent5f502c3a82827ebd76e9585e5caa015753016c6a (diff)
downloadgitlab-ce-2243f0e3deaf0c9557fdc971e566b5606e9e9c52.tar.gz
Add IncludeError exception and use it in CI config
-rw-r--r--lib/gitlab/ci/config.rb6
-rw-r--r--lib/gitlab/ci/config/external/processor.rb3
-rw-r--r--spec/lib/gitlab/ci/config_spec.rb2
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/gitlab/ci/config.rb b/lib/gitlab/ci/config.rb
index 7b3c5c12c61..fedaf18ef30 100644
--- a/lib/gitlab/ci/config.rb
+++ b/lib/gitlab/ci/config.rb
@@ -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?
diff --git a/lib/gitlab/ci/config/external/processor.rb b/lib/gitlab/ci/config/external/processor.rb
index f3b20085cd6..32890f84de9 100644
--- a/lib/gitlab/ci/config/external/processor.rb
+++ b/lib/gitlab/ci/config/external/processor.rb
@@ -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
diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb
index 7a749a2ef6d..8925b17be58 100644
--- a/spec/lib/gitlab/ci/config_spec.rb
+++ b/spec/lib/gitlab/ci/config_spec.rb
@@ -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