Fix broad exception handling in CLI step lookup and resume run-id validation#3179
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3179 +/- ##
=========================================
Coverage ? 28.31%
=========================================
Files ? 381
Lines ? 52346
Branches ? 9238
=========================================
Hits ? 14821
Misses ? 36585
Partials ? 940 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Type
Summary
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.