Skip to content

fix: raise FileNotFoundError for missing TLS material (fixes #7564)#7580

Closed
muhamedfazalps wants to merge 1 commit into
psf:mainfrom
muhamedfazalps:fix/file-not-found-for-missing-tls
Closed

fix: raise FileNotFoundError for missing TLS material (fixes #7564)#7580
muhamedfazalps wants to merge 1 commit into
psf:mainfrom
muhamedfazalps:fix/file-not-found-for-missing-tls

Conversation

@muhamedfazalps

Copy link
Copy Markdown

Fixes #7564

When a TLS certificate or key file is not found, the code currently raises a generic OSError. This changes it to raise FileNotFoundError with the proper errno (ENOENT) and filename attribute, which is more specific and allows callers to catch this specific case.

FileNotFoundError is a subclass of OSError, so this is backward compatible with existing code that catches OSError.

When a TLS certificate or key file is not found, the code currently
raises a generic OSError. This changes it to raise FileNotFoundError
with the proper errno (ENOENT) and filename attribute, which is more
specific and allows callers to catch this specific case.

FileNotFoundError is a subclass of OSError, so this is backward
compatible with existing code that catches OSError.
@muhamedfazalps muhamedfazalps force-pushed the fix/file-not-found-for-missing-tls branch from 89ccbe6 to dc81306 Compare July 12, 2026 02:03
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.

raise FileNotFoundError for missing TLS material

2 participants