Skip to content

clean up log.error #1109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025
Merged

clean up log.error #1109

merged 2 commits into from
Jul 9, 2025

Conversation

ihrpr
Copy link
Contributor

@ihrpr ihrpr commented Jul 9, 2025

We have this pattern throughout the codebase:

except Exception as e:
    logger.error(f"Something failed: {e}")

Two issues:

  1. Should use logger.exception() instead of logger.error() - it automatically includes the traceback
  2. Most catches should be specific exceptions, not generic Exception

Changes

  • Replaced logger.error()logger.exception() in exception handlers
  • Removed redundant {e} from messages (exception details are included automatically)
  • Added guidelines to CLAUDE.md to prevent this pattern in future PRs

This pattern appears to be spreading because LLMs copy existing code context.

@ihrpr ihrpr requested a review from Kludex July 9, 2025 09:30
@ihrpr ihrpr merged commit 4fee123 into main Jul 9, 2025
22 of 23 checks passed
@ihrpr ihrpr deleted the ihrpr/fix-exceptions branch July 9, 2025 10:15
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy