fix: use logger.exception() in calculate_pitcher_ratings error handler #33
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-card-creation#33
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-card-creation#17"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
logger.error(f'... due to: {e}')withlogger.exception()in thecreate_pitching_cardexcept block (pitchers/creation.py:304-307)logger.exception()automatically appends the full stack trace at ERROR level, making failures diagnosableas ebinding since the message no longer needs to embedeCloses #17
AI Code Review
Files Reviewed
pitchers/creation.py(modified)Findings
Correctness
create_pitching_card(lines 304–305 →logger.exception()) is correct and an improvement: stack traces will now appear in logs, making failures diagnosable without needing to re-addas e.logger.exception()change is increate_pitching_card. Thecalculate_pitcher_ratingserror handler (diff lines ~388–390) only received a quote style change, not thelogger.exception()upgrade.exceptblocks in the same file (create_pit_positionat ~line 366,calculate_pitcher_ratingsat ~line 388) still uselogger.error()without stack traces. These are the same pattern as the bug being fixed. Worth a follow-up issue.Security
Style & Conventions
Suggestions
logger.exception()tocreate_pit_positionandcalculate_pitcher_ratingsas well — they have the same diagnosability problem this PR set out to fix.Verdict: APPROVED
The functional change is correct and strictly improves observability. The title mismatch and inconsistent coverage of other handlers are noted but don't block merging.
Automated review by Claude PR Reviewer
AI Code Review
Files Reviewed
pitchers/creation.py(modified)Findings
Correctness
The primary change — replacing
except Exception as e: logger.error(f'... due to: {e}')withexcept Exception: logger.exception(f'...')at line 304-305 — is correct and complete.logger.exception()automatically captures and appends the current exception's traceback at ERROR level, making it strictly superior to the old pattern. Theas ebinding is correctly removed since the message no longer embeds it.The PR description says the change is to
create_pitching_card(lines 304-307), which matches the diff exactly.One note: the
calculate_pitcher_ratingsfunction at line 388-390 has a similarlogger.error()in anexcept Exceptionblock that was NOT upgraded tologger.exception(). That handler also silently drops stack traces. This is pre-existing and out of scope for this PR, but worth a follow-up.Security
No issues found. No user input handling, no credentials, no injection surface.
Style & Conventions
The remaining diff hunks (lines 196-200, 268-271, 301, 335, 366, 388-390, 527-530) are all quote-style normalizations: mixed
f'...'/f"..."strings are converted to consistent double-quotef"..."style. This is a clean housekeeping pass and follows standard Python convention. No logic is changed by these hunks.Suggestions
calculate_pitcher_ratingsat line 388-390 still useslogger.error()in anexcept Exceptionblock — the same pattern this PR fixes. Worth a follow-up issue to bring it in line with the same improvement.Verdict: APPROVED
The fix is correct, minimal, and well-scoped. The quote normalization is a harmless style cleanup with no behavioral change. No stubs, TODOs, or logic errors found. The PR description accurately describes what the diff does.
Automated review by Claude PR Reviewer
Approved. Using
logger.exception()overlogger.error()ensures the traceback is captured automatically — correct fix for the pitcher error handler.071f9f9cdfto9e48616274