From a0543e6f7b67ddf6f7f9e3a367e9a6632bd05e58 Mon Sep 17 00:00:00 2001 From: Matej Tyc Date: Fri, 6 Jan 2023 13:39:18 +0100 Subject: [PATCH] Produce an understanable error when a collection of remediation goes wrong - at least name the rule and the remediation type. --- build-scripts/collect_remediations.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build-scripts/collect_remediations.py b/build-scripts/collect_remediations.py index 2c52089426c..e6d1ddbe1a4 100755 --- a/build-scripts/collect_remediations.py +++ b/build-scripts/collect_remediations.py @@ -111,8 +111,14 @@ def collect_remediations( if fix_path is None: # neither static nor templated remediation found continue - process_remediation( - rule, fix_path, lang, output_dirs, expected_file_name, env_yaml, cpe_platforms) + try: + process_remediation( + rule, fix_path, lang, output_dirs, expected_file_name, env_yaml, cpe_platforms) + except Exception as exc: + msg = ( + "Failed to dispatch {lang} remediation for {rule_id}: {error}" + .format(lang=lang, rule_id=rule.id_, error=str(exc))) + raise RuntimeError(msg) def main():