From 62b5dd0ea74b6ab2b309900aa699d5321c0090a8 Mon Sep 17 00:00:00 2001 From: haosenwang1018 <167664334+haosenwang1018@users.noreply.github.com> Date: Thu, 26 Feb 2026 01:50:51 +0000 Subject: [PATCH] fix: replace 5 bare except clauses with except Exception --- bin/docker-to-squash.py | 2 +- bin/storm.py | 6 +++--- dev-tools/gitact/print-errors-from-test-reports.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/docker-to-squash.py b/bin/docker-to-squash.py index e63c05c27ec..4ea3a371f6b 100755 --- a/bin/docker-to-squash.py +++ b/bin/docker-to-squash.py @@ -1735,7 +1735,7 @@ def check_dependencies(): try: command = ["setfattr", "--version"] shell_command(command, False, False, True) - except: + except Exception: logging.error("Could not find setfattr . Make sure it is installed and present on the PATH") return 1 diff --git a/bin/storm.py b/bin/storm.py index 956abde0018..81d6e4e4d8e 100755 --- a/bin/storm.py +++ b/bin/storm.py @@ -230,7 +230,7 @@ def resolve_dependencies(artifacts, artifact_repositories, maven_local_repos_dir try: out_dict = json.loads(output) return out_dict - except: + except Exception: raise RuntimeError(f"dependency handler returns non-json response: sysout<{output}>", ) @@ -1126,7 +1126,7 @@ def set_log_level(args): if ":" in new_value: _, timeout = new_value.split(":") int(timeout) - except: + except Exception: raise argparse.ArgumentTypeError("Should be in the form[logger name]=[log level][:optional timeout]") exec_storm_class( "org.apache.storm.command.SetLogLevel", @@ -1152,7 +1152,7 @@ def rebalance(args): new_value = int(new_value) if new_value < 0: raise argparse.ArgumentTypeError("Executor count should be > 0") - except: + except Exception: raise argparse.ArgumentTypeError("Should be in the form component_name=new_executor_count") exec_storm_class( "org.apache.storm.command.Rebalance", diff --git a/dev-tools/gitact/print-errors-from-test-reports.py b/dev-tools/gitact/print-errors-from-test-reports.py index 886b9ab557e..1c659ab9915 100644 --- a/dev-tools/gitact/print-errors-from-test-reports.py +++ b/dev-tools/gitact/print-errors-from-test-reports.py @@ -38,7 +38,7 @@ def print_error_reports_from_report_file(file_path): tree = ElementTree() try: tree.parse(file_path) - except: + except Exception: print("-" * 50) print("Error parsing %s"%file_path) f = open(file_path, "r")