Fix broad exception handling in CLI step lookup and resume run-id validation#3179
Fix broad exception handling in CLI step lookup and resume run-id validation#3179LuisJG8 wants to merge 1 commit intoNetflix:masterfrom
Conversation
Greptile SummaryThis PR tightens two overly broad
Confidence Score: 5/5Safe to merge — both changes are minimal, targeted narrowings of exception scope with no behavioral change on the happy path. Both changes correctly identify the expected exceptions for their respective operations: ValueError/TypeError for int() conversion of a string, and AttributeError for a missing getattr result. No logic is altered, no new code paths are introduced, and the fix prevents real internal exceptions from being silently swallowed and misreported as user-facing CLI errors. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "Narrow CLI exception handling in step/re..." | Re-trigger Greptile |
PR Type
Summary
Hi, this PR fixes CLI error-handling behavior in two command paths.
In
metaflow/cli_components/step_cmd.py, the step lookup now catches onlyAttributeErrorwhen a step is missing, instead of a bareexcept. Inmetaflow/cli_components/run_cmds.py,run_idvalidation now catches onlyTypeErrorandValueErrorwhen checking whether the value is an integer.I added these changes to prevent unrelated internal exceptions from being swallowed and reported as user-facing command errors, while preserving existing CLI behavior for valid and invalid inputs.