Skip to content

fix: narrow exceptions in get_speckit_version() from Exception to specific types - #3917

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

fix: narrow exceptions in get_speckit_version() from Exception to specific types#3917
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/assets-narrow-exception-v2

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

Outer catch narrowed to PackageNotFoundError. Inner catch narrowed to (OSError, ValueError, KeyError) for file/parse errors.

Fix

Narrowed both exception handlers to specific types.

Testing

  • Verified version is returned correctly
  • Verified fallback to pyproject.toml works

…cific types

Outer catch narrowed to PackageNotFoundError (the only expected
failure from importlib.metadata.version). Inner catch narrowed to
(OSError, ValueError, KeyError) for file/parse errors.
@Quratulain-bilal
Quratulain-bilal requested a review from mnriem as a code owner July 31, 2026 14:44
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