graphql-dotnet / graphql-dotnet/graphql-client

The HTTP request failed with status code InternalServerError

Open
#374 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
648
Forks
136
PR merge metrics
No merged PRs in 30d

Description

When I execute a mutation for deleting I don't get the errors in Errors but instead the 'graphQLResponse = await graphQlClient.SendQueryAsync(request);' will throw and InternalServerError

So I would like to get this error handled by just checking if there are any errors in the response, but since it throws an InternalServerError I can't, and they are also null, as you can see here(this is the serialized response):
{
"Data": null,
"Errors": null,
"Extensions": null
}

And this is the response I get when I use **Banana Cake Pop** with the same query.

{
"errors": [
{
"message": "Unexpected Execution Error",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"deleteVehicle"
],
"extensions": {
"message": "Not found",
"stackTrace": " _Very long and not so interesting"_
}
}
]
}

Stack trace:
GraphQL.Client.Http.GraphQLHttpRequestException: The HTTP request failed with status code InternalServerError
at GraphQL.Client.Http.GraphQLHttpClient.SendHttpRequestAsync[TResponse](GraphQLRequest request, CancellationToken cancellationToken)
at GraphQL.Client.Http.GraphQLHttpClient.SendQueryAsync[TResponse](GraphQLRequest request, CancellationToken cancellationToken)
at CarRentalClientServer.Data.VehicleServiceGraphQL.DeleteVehicleAsync(Int32 id)
System.AggregateException: One or more errors occurred. (The HTTP request failed with status code InternalServerError)
---> GraphQL.Client.Http.GraphQLHttpRequestException: The HTTP request failed with status code InternalServerError
at GraphQL.Client.Http.GraphQLHttpClient.SendHttpRequestAsync[TResponse](GraphQLRequest request, CancellationToken cancellationToken)
at GraphQL.Client.Http.GraphQLHttpClient.SendQueryAsync[TResponse](GraphQLRequest request, CancellationToken cancellationToken)
at CarRentalClientServer.Data.VehicleServiceGraphQL.DeleteVehicleAsync(Int32 id)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at CarRentalClientServer.Program.Main(String[] args)

Query:
mutation
DeleteVehicle($id : Int!)
{
deleteVehicle(id : $id)
}

Thanks in advance.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.