Skip to content

Narrow ~104 bare except blocks to typed exceptions across src/powertrader/#6

Merged
Ibrahim-3d merged 1 commit into
mainfrom
claude/start-phase-7-nJ5N6
Feb 11, 2026
Merged

Narrow ~104 bare except blocks to typed exceptions across src/powertrader/#6
Ibrahim-3d merged 1 commit into
mainfrom
claude/start-phase-7-nJ5N6

Conversation

@Ibrahim-3d
Copy link
Copy Markdown
Owner

Phase 7 exception handling completion: replace broad except Exception
blocks with specific exception types throughout the refactored codebase.

  • core/trading_client.py: Wrap unknown errors in ExchangeError/OrderError
    at API boundaries; eliminate redundant catch-alls for poll/info/price
  • core/credentials.py: Narrow keyring fallback to (OSError, RuntimeError, ValueError)
  • hub/app.py: Narrow 75 GUI exception handlers to tk.TclError and
    appropriate data/IO types based on operation context
  • hub/components/: Narrow chart rendering, dashboard, fetcher, and
    wrap_frame exceptions to specific matplotlib/tk/IO types
  • hub/dialogs/settings_dialog.py: Narrow save/credential/folder operations
    to OSError and validation types
  • hub/process_manager.py: Narrow polling schedule to (RuntimeError, ValueError, TypeError)
  • trainer/thinker/trader runners: Narrow last-resort catches to
    (RuntimeError, ValueError, TypeError, KeyError, IndexError, ArithmeticError)

All 560 tests pass. Only 2 intentional except Exception remain in
trading_client.py as exception-conversion points (raise ExchangeError from exc).

https://claude.ai/code/session_01RLKga57hGTsf1yBZ6ccVQ4

…ader/

Phase 7 exception handling completion: replace broad `except Exception`
blocks with specific exception types throughout the refactored codebase.

- core/trading_client.py: Wrap unknown errors in ExchangeError/OrderError
  at API boundaries; eliminate redundant catch-alls for poll/info/price
- core/credentials.py: Narrow keyring fallback to (OSError, RuntimeError, ValueError)
- hub/app.py: Narrow 75 GUI exception handlers to tk.TclError and
  appropriate data/IO types based on operation context
- hub/components/: Narrow chart rendering, dashboard, fetcher, and
  wrap_frame exceptions to specific matplotlib/tk/IO types
- hub/dialogs/settings_dialog.py: Narrow save/credential/folder operations
  to OSError and validation types
- hub/process_manager.py: Narrow polling schedule to (RuntimeError, ValueError, TypeError)
- trainer/thinker/trader runners: Narrow last-resort catches to
  (RuntimeError, ValueError, TypeError, KeyError, IndexError, ArithmeticError)

All 560 tests pass. Only 2 intentional `except Exception` remain in
trading_client.py as exception-conversion points (raise ExchangeError from exc).

https://claude.ai/code/session_01RLKga57hGTsf1yBZ6ccVQ4
@Ibrahim-3d Ibrahim-3d merged commit 02b1204 into main Feb 11, 2026
0 of 3 checks passed
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