From eae6d1078487dce25f160b630b0fc7f7645595c8 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 6 May 2025 12:17:17 +0800 Subject: [PATCH] enhance: only log exception in popup task (#1281) Signed-off-by: leo --- src/App.axaml.cs | 2 +- src/ViewModels/LauncherPage.cs | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index c54b616d..6e45164d 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -78,7 +78,7 @@ namespace SourceGit return builder; } - private static void LogException(Exception ex) + public static void LogException(Exception ex) { if (ex == null) return; diff --git a/src/ViewModels/LauncherPage.cs b/src/ViewModels/LauncherPage.cs index b97ef6f7..3affe71d 100644 --- a/src/ViewModels/LauncherPage.cs +++ b/src/ViewModels/LauncherPage.cs @@ -100,23 +100,32 @@ namespace SourceGit.ViewModels public async void ProcessPopup() { - if (_popup is { InProgress: false }) + if (_popup is { InProgress: false } dump) { - if (!_popup.Check()) + if (!dump.Check()) return; - _popup.InProgress = true; - var task = _popup.Sure(); + dump.InProgress = true; + var task = dump.Sure(); + var finished = false; if (task != null) { - var finished = await task; - _popup.InProgress = false; + try + { + finished = await task; + } + catch (Exception e) + { + App.LogException(e); + } + + dump.InProgress = false; if (finished) Popup = null; } else { - _popup.InProgress = false; + dump.InProgress = false; Popup = null; } }