Skip to content

fix: narrow bare except Exception in version fallback - #3835

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/assets-narrow-exception
Open

fix: narrow bare except Exception in version fallback#3835
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/assets-narrow-exception

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Summary

Replace overly broad except Exception with specific exception types in get_speckit_version() fallback.

Changes

  • _assets.py: Narrow outer exception to PackageNotFoundError
  • _assets.py: Narrow inner exception to (OSError, KeyError, ValueError)

Replace overly broad except Exception with specific exception types:
- importlib.metadata.PackageNotFoundError for missing package
- (OSError, KeyError, ValueError) for pyproject.toml read/parse errors

This prevents silently swallowing unexpected errors like AttributeError
or RecursionError from broken tomllib or malformed pyproject.toml.
@Quratulain-bilal
Quratulain-bilal requested a review from mnriem as a code owner July 29, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant