Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions GraphQLSharp/Client/Exceptions/GraphQLHttpException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ namespace GraphQLSharp;

public class GraphQLHttpException : GraphQLException
{
public IReadOnlyList<string> Errors { get; }

public GraphQLHttpException(GraphQLRequest request, HttpResponse httpResponse, Exception ex)
: this(new GraphQLHttpError { Request = request, HttpResponse = httpResponse }, ex)
{
}

public GraphQLHttpException(GraphQLHttpError error, Exception ex)
: base(error.Request, error.HttpResponse, $"""
GraphQL request failed with an HTTP error: {(error.errors != null ? string.Join("\n", error.errors) : "")}
Request: {error.Request}
: base(request, httpResponse, $"""
GraphQL request failed with an HTTP error:
Request: {request}
""", ex)
{
Errors = Array.AsReadOnly(error.errors?.ToArray() ?? Array.Empty<string>());
}
}
}
17 changes: 2 additions & 15 deletions GraphQLSharp/Client/GraphQLClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,7 @@ private async Task<GraphQLResponse<T>> ExecuteCoreAsync<T>(TRequest request, Can
}
catch (Exception httpEx)
{
GraphQLHttpError gqlHttpError = null;
try
{
gqlHttpError = await httpResponseMsg.Content.ReadFromJsonAsync<GraphQLHttpError>(_options.JsonSerializerOptions ?? Serializer.GetOptions(),
cancellationToken);
}
catch (Exception errorDetailsException) when (errorDetailsException is JsonException or InvalidOperationException)
{
// Error details are optional; preserve the HTTP failure for callers and retries.
}
gqlHttpError ??= new GraphQLHttpError();
gqlHttpError.Request = request;
gqlHttpError.HttpResponse = httpResponse;
throw new GraphQLHttpException(gqlHttpError, httpEx);
throw new GraphQLHttpException(request, httpResponse, httpEx);
}

GraphQLResponse<T> res;
Expand Down Expand Up @@ -161,4 +148,4 @@ private HttpRequestMessage CreateHttpRequest(TRequest request, HttpClient httpCl
_options.ConfigureHttpRequestHeaders?.Invoke(requestMessage.Headers);
return requestMessage;
}
}
}
15 changes: 0 additions & 15 deletions GraphQLSharp/Client/Response/GraphQLHttpError.cs

This file was deleted.

2 changes: 1 addition & 1 deletion GraphQLSharp/GraphQLSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageProjectUrl>https://github.com/Wish-Org/GraphQLSharp</PackageProjectUrl>
<RepositoryUrl>https://github.com/Wish-Org/GraphQLSharp</RepositoryUrl>
<Description>.NET Client for GraphQL - Modern and fast</Description>
<Version>2.24.0</Version>
<Version>2.23.0</Version>
<PackageTags>graphql;client;graphql-client;graphql-generator</PackageTags>
<Authors>Wish-Org</Authors>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
45 changes: 0 additions & 45 deletions GraphQLSharp/Serialization/GraphQLHttpErrorMessageConverter.cs

This file was deleted.

Loading