Don't rescue Exception, but StandardError

This commit is contained in:
Kamil Trzcinski 2015-11-19 20:16:56 +01:00
parent a5b10196e6
commit 8248314bc9
2 changed files with 5 additions and 8 deletions

View file

@ -15,10 +15,10 @@ module Ci
@builds = @config_processor.builds
@status = true
end
rescue Ci::GitlabCiYamlProcessor::ValidationError => e
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
@error = e.message
@status = false
rescue Exception
rescue
@error = "Undefined error"
@status = false
end

View file

@ -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