Skip to content

Commit 6c2bd2d

Browse files
committed
properly mark update as failed
1 parent a277408 commit 6c2bd2d

File tree

1 file changed

+25
-3
lines changed
  • Framework/Intersect.Framework.Core/AssetManagement

1 file changed

+25
-3
lines changed

Framework/Intersect.Framework.Core/AssetManagement/Updater.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,11 @@ private void RunUpdates(CancellationToken cancellationToken)
384384
throw new UnreachableException();
385385
}
386386

387+
if (updateManifest == null)
388+
{
389+
throw new InvalidOperationException($"Manifest is null despite a status of {manifestStatus}");
390+
}
391+
387392
assetManifest = new UpdateManifest
388393
{
389394
StreamingUrl = updateManifest.StreamingUrl,
@@ -518,9 +523,26 @@ private void RunUpdates(CancellationToken cancellationToken)
518523
thread.Join();
519524
}
520525

526+
if (!_failed)
527+
{
528+
foreach (var (file, result) in _downloadResults)
529+
{
530+
if (result.State != DownloadState.Failed)
531+
{
532+
continue;
533+
}
534+
535+
ApplicationContext.CurrentContext.Logger.LogError(
536+
"Download of {File} marked as {DownloadState}, marking update as failed",
537+
file.Path,
538+
result.State
539+
);
540+
_failed = true;
541+
}
542+
}
543+
521544
if (_failed)
522545
{
523-
_failed = true;
524546
Status = UpdateStatus.Error;
525547
return;
526548
}
@@ -808,8 +830,8 @@ private bool StreamDownloads(UpdateManifest updateManifest, CancellationToken ca
808830
try
809831
{
810832
if (targetFileInfo.Exists)
811-
{
812-
targetFileInfo.Delete();
833+
{
834+
targetFileInfo.Delete();
813835
}
814836
}
815837
catch (Exception exception)

0 commit comments

Comments
 (0)