Skip to content

gh-135683: Honor raiseExceptions when opening the file fails in FileHandler#154542

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:fix-filehandler-raiseexceptions
Open

gh-135683: Honor raiseExceptions when opening the file fails in FileHandler#154542
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:fix-filehandler-raiseexceptions

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

FileHandler and WatchedFileHandler opened the file outside the try block that reports errors via handleError(), so an error while opening the file was raised instead of being handled, ignoring raiseExceptions. The rotating handlers were not affected, as BaseRotatingHandler.emit() wraps the whole body.

🤖 Generated with Claude Code

… FileHandler

FileHandler and WatchedFileHandler opened the file outside the try block
that reports errors via handleError(), so an error while opening the file
was raised instead of being handled, ignoring raiseExceptions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Split the WatchedFileHandler case into a separate test skipped on
Windows, where open log files are locked and the directory holding
them cannot be removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant