From 9265e7692033c8a38ade4e31281613e3fb299611 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 13 Jul 2018 05:08:45 +0200 Subject: Use the correct exceptions to look for invalid YAML in Changelogs --- danger/changelog/Dangerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'danger/changelog/Dangerfile') diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 2424e650d07..0374de24520 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -38,12 +38,14 @@ def check_changelog(path) if yaml["merge_request"].nil? message "Consider setting `merge_request` to #{gitlab.mr_json["iid"]} in #{gitlab.html_link(path)}. #{SEE_DOC}" - elsif yaml["merge_request"] != gitlab.mr_json["iid"] && !ce_port_changelog?(changelog_path) + elsif yaml["merge_request"] != gitlab.mr_json["iid"] && !ce_port_changelog?(path) fail "Merge request ID was not set to #{gitlab.mr_json["iid"]}! #{SEE_DOC}" end -rescue StandardError +rescue Psych::SyntaxError, Psych::DisallowedClass, Psych::BadAlias # YAML could not be parsed, fail the build. fail "#{gitlab.html_link(path)} isn't valid YAML! #{SEE_DOC}" +rescue StandardError => e + warn "There was a problem trying to check the Changelog. Exception: #{e.name} - #{e.message}" end def presented_no_changelog_labels -- cgit v1.2.1