Skip to content

Commit

Permalink
added exception data for failed manifest downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
NotOfficer committed Jun 10, 2024
1 parent 1865af6 commit b503997
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/EpicManifestParser/Api/ManifestInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public class ManifestInfo
/// <returns>
/// The parsed <see cref="FBuildPatchAppManifest"/> manifest and the selected <see cref="ManifestInfoElement"/> info element in a <see cref="ValueTuple"/>
/// </returns>
/// <exception cref="InvalidOperationException"></exception>
/// <exception cref="InvalidOperationException">When a predicate fails.</exception>
/// <exception cref="HttpRequestException">When the manifest data fails to download.</exception>
public async Task<(FBuildPatchAppManifest Manifest, ManifestInfoElement InfoElement)> DownloadAndParseAsync(
ManifestParseOptions options, Predicate<ManifestInfoElement>? elementPredicate = null,
Predicate<ManifestInfoElementManifest>? elementManifestPredicate = null, CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -188,7 +189,20 @@ static ReadOnlySpan<char> GetFileName(Uri uri)
}

options.CreateDefaultClient();
var manifestBuffer = await options.Client!.GetByteArrayAsync(manifestUri, cancellationToken).ConfigureAwait(false);
byte[] manifestBuffer;

try
{
manifestBuffer = await options.Client!.GetByteArrayAsync(manifestUri, cancellationToken).ConfigureAwait(false);
}
catch (HttpRequestException httpEx)
{
httpEx.Data.Add("ManifestUri", manifestUri);
httpEx.Data.Add("ElementManifest", elementManifest);
httpEx.Data.Add("Element", element);
throw;
}

var manifest = FBuildPatchAppManifest.Deserialize(manifestBuffer, options);

if (cachePath is not null)
Expand Down

0 comments on commit b503997

Please sign in to comment.