From 2b907f61ff5db3ff68b27a9d3bb164745ab7703b Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 18 Nov 2015 16:32:00 +0100 Subject: Commits without .gitlab-ci.yml are marked as skipped - Save detailed error when YAML syntax --- app/models/ci/commit.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/models/ci/commit.rb') diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 33b57173928..73c1570c212 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -188,12 +188,15 @@ module Ci end def config_processor + return nil unless ci_yaml_file @config_processor ||= Ci::GitlabCiYamlProcessor.new(ci_yaml_file, gl_project.path_with_namespace) rescue Ci::GitlabCiYamlProcessor::ValidationError => e save_yaml_error(e.message) nil + rescue Psych::SyntaxError => e + save_yaml_error(e.message) + nil rescue Exception => e - logger.error e.message + "\n" + e.backtrace.join("\n") save_yaml_error("Undefined yaml error") nil end -- cgit v1.2.1 From 0df7a32ea50baf251f03e6bfc5b91c5ccb68aad0 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 19 Nov 2015 12:08:30 +0100 Subject: Fix tests --- app/models/ci/commit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/ci/commit.rb') diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 73c1570c212..b0c78499e49 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -196,7 +196,7 @@ module Ci rescue Psych::SyntaxError => e save_yaml_error(e.message) nil - rescue Exception => e + rescue Exception save_yaml_error("Undefined yaml error") nil end -- cgit v1.2.1 From 8248314bc9256d3a0252ad6322df098edca7385a Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 19 Nov 2015 20:16:56 +0100 Subject: Don't rescue Exception, but StandardError --- app/models/ci/commit.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'app/models/ci/commit.rb') diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index b0c78499e49..971e899de84 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -190,14 +190,11 @@ module Ci def config_processor return nil unless ci_yaml_file @config_processor ||= Ci::GitlabCiYamlProcessor.new(ci_yaml_file, gl_project.path_with_namespace) - rescue Ci::GitlabCiYamlProcessor::ValidationError => e + rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e save_yaml_error(e.message) nil - rescue Psych::SyntaxError => e - save_yaml_error(e.message) - nil - rescue Exception - save_yaml_error("Undefined yaml error") + rescue + save_yaml_error("Undefined error") nil end -- cgit v1.2.1