Skip to content

Quality: Exception string is empty when filepath is absent#433

Open
tuanaiseo wants to merge 1 commit into
Johnserf-Seed:mainfrom
tuanaiseo:contribai/improve/quality/exception-string-is-empty-when-filepath-
Open

Quality: Exception string is empty when filepath is absent#433
tuanaiseo wants to merge 1 commit into
Johnserf-Seed:mainfrom
tuanaiseo:contribai/improve/quality/exception-string-is-empty-when-filepath-

Conversation

@tuanaiseo

Copy link
Copy Markdown

Problem

FileError.__str__ returns an empty string if self.filepath is falsy, which hides the original exception message and makes debugging/logging significantly harder.

Severity: high
File: f2/exceptions/file_exceptions.py

Solution

Always include the base exception message. Example: msg = super().__str__(); return f"{msg} Filepath: {self.filepath}" if self.filepath else msg.

Changes

  • f2/exceptions/file_exceptions.py (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

`FileError.__str__` returns an empty string if `self.filepath` is falsy, which hides the original exception message and makes debugging/logging significantly harder.

Affected files: file_exceptions.py

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant