From acf1b7a3217ee262e26d6696a91212c6dce492c8 Mon Sep 17 00:00:00 2001 From: Luis Gonzalez Date: Wed, 6 May 2026 14:43:47 -0400 Subject: [PATCH] Narrow CLI exception handling in step/resume commands --- metaflow/cli_components/run_cmds.py | 2 +- metaflow/cli_components/step_cmd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metaflow/cli_components/run_cmds.py b/metaflow/cli_components/run_cmds.py index 82272b70568..64d7a2fa347 100644 --- a/metaflow/cli_components/run_cmds.py +++ b/metaflow/cli_components/run_cmds.py @@ -278,7 +278,7 @@ def resume( # be non-integers to avoid any clashes. This condition ensures this. try: int(run_id) - except: + except (TypeError, ValueError): pass else: raise CommandException("run-id %s cannot be an integer" % run_id) diff --git a/metaflow/cli_components/step_cmd.py b/metaflow/cli_components/step_cmd.py index 24ca9d784a0..6f7d719cf01 100644 --- a/metaflow/cli_components/step_cmd.py +++ b/metaflow/cli_components/step_cmd.py @@ -127,7 +127,7 @@ def step( func = None try: func = getattr(ctx.obj.flow, step_name) - except: + except AttributeError: raise CommandException("Step *%s* doesn't exist." % step_name) if not func.is_step: raise CommandException("Function *%s* is not a step." % step_name)