Skip to content

fix: 消除全项目空 catch 静默吞异常,统一异常处理规范#119

Merged
DoomVoss merged 1 commit into
DoomVoss:mainfrom
ABA2396:fix/silent-catch
Jun 30, 2026
Merged

fix: 消除全项目空 catch 静默吞异常,统一异常处理规范#119
DoomVoss merged 1 commit into
DoomVoss:mainfrom
ABA2396:fix/silent-catch

Conversation

@ABA2396

@ABA2396 ABA2396 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

此前项目中大量使用空 catch { } 静默吞掉异常,导致配置读写失败、
资源清理失败等情况完全不可追踪,排查问题困难。同时部分位置使用
Debug.WriteLine 记录异常

以及怎么有这么多格式问题

此前项目中大量使用空 catch { } 静默吞掉异常,导致配置读写失败、
资源清理失败等情况完全不可追踪,排查问题困难。同时部分位置使用
Debug.WriteLine 记录异常
Copilot AI review requested due to automatic review settings June 27, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with AppLogger.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 catch blocks.

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.

Comment thread src/ConfigManager.cs
Comment thread src/ConfigManager.cs
Comment thread src/ConfigManager.cs
Comment thread src/ConfigManager.cs
Comment thread src/ConfigManager.cs
Comment thread src/ControlPanelWindow.xaml.cs
Comment thread src/MainWindow.xaml.cs
Comment thread src/App.xaml.cs
Comment thread src/App.xaml.cs
Comment thread src/App.xaml.cs
@DoomVoss DoomVoss merged commit 3896ece into DoomVoss:main Jun 30, 2026
1 check 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.

4 participants