catch errors on update/install

This commit is contained in:
2023-08-26 16:31:36 +02:00
parent 9407f3fed6
commit 7e814b37c3

View File

@@ -84,7 +84,13 @@ Public Class Form1
'Check only if not pressed "install", not really needed otherwise.
If lastUpdateCheckResult Is Nothing OrElse Not doInstall Then
SetStatus(LangRes.StatusText_CheckingForUpdates, MySymbols.icons8_update_16px)
lastUpdateCheckResult = Await updater.CheckForUpdates(Not AppConfig.Instance.AllowRemoveLocalFiles)
Try
lastUpdateCheckResult = Await updater.CheckForUpdates(Not AppConfig.Instance.AllowRemoveLocalFiles)
Catch
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px)
Finally
End Try
End If
If lastUpdateCheckResult Is Nothing OrElse lastUpdateCheckResult.HasError Then
@@ -94,14 +100,18 @@ Public Class Form1
SetStatus(LangRes.StatusText_Installing, MySymbols.icons8_software_installer_16px)
currentUpdating = True
If Await updater.InstallUpdates(lastUpdateCheckResult) Then
lastUpdateCheckResult = Nothing 'Reset last update check, a new one would be needed now.
SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px)
Else
Try
If Await updater.InstallUpdates(lastUpdateCheckResult) Then
lastUpdateCheckResult = Nothing 'Reset last update check, a new one would be needed now.
SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px)
Else
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px)
End If
Catch
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px)
End If
currentUpdating = False
Finally
currentUpdating = False
End Try
Else
SetStatus(LangRes.StatusText_UpdateAvailable, MySymbols.icons8_software_installer_16px)
End If