Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle subgraph transport errors #6968

Closed
wants to merge 9 commits into from

Conversation

tobias-tengler
Copy link
Collaborator

Fixes #6752

Copy link

github-actions bot commented Mar 4, 2024

Qodana for .NET

5 new problems were found

Inspection name Severity Problems
Redundant nullable warning suppression expression 🔶 Warning 4
Redundant using directive 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

@tobias-tengler tobias-tengler force-pushed the improve-fusion-transport-error-handling branch from 5c8b87e to 5653f05 Compare March 10, 2024 13:32
@@ -100,8 +98,7 @@ public ValueTask<OperationResult> ReadAsResultAsync(CancellationToken cancellati
#endif
}

// if the media type is anything else we will return a transport error.
return new ValueTask<OperationResult>(_transportError);
throw new Exception("Transport error");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw a proper exception and why was the previous behavior even there?

@@ -187,7 +184,7 @@ public IAsyncEnumerable<OperationResult> ReadAsResultStreamAsync(CancellationTok
#endif
}

return SingleResult(new ValueTask<OperationResult>(_transportError));
throw new Exception("Stream transport error");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing

using var response = await _client.SendAsync(request, ct).ConfigureAwait(false);
var result = await response.ReadAsResultAsync(ct).ConfigureAwait(false);
return new GraphQLResponse(result);
}
catch
{
return _transportError;
return new GraphQLResponse(true);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing

HasError = hasError;
}

public bool HasError { get; }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct, as there can be both successful and unsuccessful data as part of a single SelectionData.

@tobias-tengler tobias-tengler deleted the improve-fusion-transport-error-handling branch November 9, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subgraph transport exception for fields below an entity cause entire entity to be nulled
1 participant