8000 enhance: only log exception in popup task (#1281) · sourcegit-scm/sourcegit@eae6d10 · GitHub
[go: up one dir, main page]

Skip to content

Commit eae6d10

Browse files
committed
enhance: only log exception in popup task (#1281)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 4bc5b90 commit eae6d10

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/App.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static AppBuilder BuildAvaloniaApp()
7878
return builder;
7979
}
8080

81-
private static void LogException(Exception ex)
81+
public static void LogException(Exception ex)
8282
{
8383
if (ex == null)
8484
return;

src/ViewModels/LauncherPage.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,32 @@ public void StartPopup(Popup popup)
100100

101101
public async void ProcessPopup()
102102
{
103-
if (_popup is { InProgress: false })
103+
if (_popup is { InProgress: false } dump)
104104
{
105-
if (!_popup.Check())
105+
if (!dump.Check())
106106
return;
107107

108-
_popup.InProgress = true;
109-
var task = _popup.Sure();
108+
dump.InProgress = true;
109+
var task = dump.Sure();
110+
var finished = false;
110111
if (task != null)
111112
{
112-
var finished = await task;
113-
_popup.InProgress = false;
113+
try
114+
{
115+
finished = await task;
116+
}
117+
catch (Exception e)
118+
{
119+
App.LogException(e);
120+
}
121+
122+
dump.InProgress = false;
114123
if (finished)
115124
Popup = null;
116125
}
117126
else
118127
{
119-
_popup.InProgress = false;
128+
dump.InProgress = false;
120129
Popup = null;
121130
}
122131
}

0 commit comments

Comments
 (0)
0