[loop-generated] [refactor] Break up error_capture.capture_error() — 138 lines #506

Closed
opened 2026-03-19 23:09:58 +00:00 by Timmy · 1 comment
Owner

File: src/infrastructure/error_capture.py:103

capture_error() is 138 lines. Second-largest function in the codebase.

Suggested approach:

  • Extract context gathering into _gather_error_context()
  • Extract formatting into _format_error_report()
  • Extract storage/notification into _persist_error()

Acceptance criteria:

  • capture_error() under 50 lines
  • All tests pass
  • No behavior changes

Files: src/infrastructure/error_capture.py

**File:** `src/infrastructure/error_capture.py:103` `capture_error()` is 138 lines. Second-largest function in the codebase. **Suggested approach:** - Extract context gathering into `_gather_error_context()` - Extract formatting into `_format_error_report()` - Extract storage/notification into `_persist_error()` **Acceptance criteria:** - `capture_error()` under 50 lines - All tests pass - No behavior changes **Files:** `src/infrastructure/error_capture.py`
Author
Owner

Instructions for Kimi:

  1. Read src/infrastructure/error_capture.py, find capture_error() at line 103 (138 lines)
  2. Extract into smaller functions:
    • _gather_error_context(exc, request, ...) — collects system/request context
    • _format_error_report(context, ...) — formats the error report
    • _persist_error(report, ...) — stores/notifies
  3. capture_error() should orchestrate these and be under 50 lines
  4. Run tox -e unit to verify all tests pass
  5. No behavior changes — pure refactor

Files: src/infrastructure/error_capture.py only

**Instructions for Kimi:** 1. Read `src/infrastructure/error_capture.py`, find `capture_error()` at line 103 (138 lines) 2. Extract into smaller functions: - `_gather_error_context(exc, request, ...)` — collects system/request context - `_format_error_report(context, ...)` — formats the error report - `_persist_error(report, ...)` — stores/notifies 3. `capture_error()` should orchestrate these and be under 50 lines 4. Run `tox -e unit` to verify all tests pass 5. No behavior changes — pure refactor **Files:** `src/infrastructure/error_capture.py` only
kimi was assigned by Timmy 2026-03-19 23:10:14 +00:00
Timmy closed this issue 2026-03-20 00:03:30 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#506