Narrow ~104 bare except blocks to typed exceptions across src/powertrader/#6
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 7 exception handling completion: replace broad
except Exceptionblocks with specific exception types throughout the refactored codebase.
at API boundaries; eliminate redundant catch-alls for poll/info/price
appropriate data/IO types based on operation context
wrap_frame exceptions to specific matplotlib/tk/IO types
to OSError and validation types
(RuntimeError, ValueError, TypeError, KeyError, IndexError, ArithmeticError)
All 560 tests pass. Only 2 intentional
except Exceptionremain intrading_client.py as exception-conversion points (raise ExchangeError from exc).
https://claude.ai/code/session_01RLKga57hGTsf1yBZ6ccVQ4