enhance: only log exception in popup task (#1281)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-06 12:17:17 +08:00
parent 4bc5b90e6b
commit eae6d10784
No known key found for this signature in database
2 changed files with 17 additions and 8 deletions

View file

@ -78,7 +78,7 @@ namespace SourceGit
return builder; return builder;
} }
private static void LogException(Exception ex) public static void LogException(Exception ex)
{ {
if (ex == null) if (ex == null)
return; return;

View file

@ -100,23 +100,32 @@ namespace SourceGit.ViewModels
public async void ProcessPopup() public async void ProcessPopup()
{ {
if (_popup is { InProgress: false }) if (_popup is { InProgress: false } dump)
{ {
if (!_popup.Check()) if (!dump.Check())
return; return;
_popup.InProgress = true; dump.InProgress = true;
var task = _popup.Sure(); var task = dump.Sure();
var finished = false;
if (task != null) if (task != null)
{ {
var finished = await task; try
_popup.InProgress = false; {
finished = await task;
}
catch (Exception e)
{
App.LogException(e);
}
dump.InProgress = false;
if (finished) if (finished)
Popup = null; Popup = null;
} }
else else
{ {
_popup.InProgress = false; dump.InProgress = false;
Popup = null; Popup = null;
} }
} }