diff options
author | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-08-25 14:40:35 +0300 |
---|---|---|
committer | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-09-07 13:10:49 +0300 |
commit | 9e313c129418f847498e771abd6bea53884682b5 (patch) | |
tree | 0604e2383bde88722e7b565d54b188f90c426ebe /lib/ci | |
parent | de2e8d4a559bd99479f46e527d8e78f67ad37de6 (diff) |
Add class method to encapsulate exception
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 47efd5bd9f2..9799f494df6 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -78,6 +78,15 @@ module Ci } end + def self.validate(content) + begin + Ci::GitlabCiYamlProcessor.new(content) + "valid" + rescue ValidationError, Psych::SyntaxError => e + e.message + end + end + private def initial_parsing |