fix: 消除全项目空 catch 静默吞异常,统一异常处理规范#119
Merged
Merged
Conversation
此前项目中大量使用空 catch { } 静默吞掉异常,导致配置读写失败、
资源清理失败等情况完全不可追踪,排查问题困难。同时部分位置使用
Debug.WriteLine 记录异常
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate “silent” exception swallowing across the project by replacing empty catch { } / Debug.WriteLine(...) patterns with a more consistent logging approach (primarily via AppLogger), improving diagnosability of configuration and runtime failures.
Changes:
- Replace some
Debug.WriteLine(ex.Message)exception handling withAppLogger.Warn(...). - Add warning logs when config load/save/parse operations fail instead of silently falling back.
- Minor whitespace/format cleanups and explanatory inline comments in best-effort
catchblocks.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TelemetryHelper.cs | Replaces empty catches with explanatory comments for telemetry/environment detection fallbacks. |
| src/OverlayManager.cs | Logs overlay-close failures via AppLogger.Warn instead of Debug.WriteLine. |
| src/MainWindow.xaml.cs | Adds a comment to the best-effort WebView2 event unsubscription catch. |
| src/ControlPanelWindow.xaml.cs | Logs process enumeration failures via AppLogger.Warn and applies minor formatting fixes. |
| src/ConfigManager.cs | Adds AppLogger.Warn logs for config load/save/parse/reset failure paths that were previously silent. |
| src/App.xaml.cs | Minor formatting and adds comments to best-effort shutdown cleanup catches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
DoomVoss
approved these changes
Jun 30, 2026
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.
此前项目中大量使用空 catch { } 静默吞掉异常,导致配置读写失败、
资源清理失败等情况完全不可追踪,排查问题困难。同时部分位置使用
Debug.WriteLine 记录异常
以及怎么有这么多格式问题