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