Skip to content

Commit

Permalink
fix: check errors field
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed Oct 29, 2024
1 parent 61ac9a1 commit 6f567ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Mimir.Worker/Client/HeadlessGQLClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private async Task<T> PostGraphQLRequestAsync<T>(
jsonResponse
);

if (graphQLResponse is null || graphQLResponse.Data is null)
if (graphQLResponse is null || graphQLResponse.Data is null || graphQLResponse.Errors is not null)
{
throw new HttpRequestException("Response data is null.");
}
Expand Down
5 changes: 4 additions & 1 deletion Mimir.Worker/Client/Models.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Mimir.Worker.Client;
Expand All @@ -14,7 +15,9 @@ public class GraphQLRequest
public class GraphQLResponse<T>
{
[JsonPropertyName("data")]
public T Data { get; set; }
public T? Data { get; set; }

public JsonElement[]? Errors { get; set; }
}

public class GetAccountDiffsResponse
Expand Down

0 comments on commit 6f567ed

Please sign in to comment.