Skip to content

Add error messages when available to GraphQLHttpException - #15

Open
matnun-br wants to merge 6 commits into
mainfrom
feat/add-errormsg-to-graphqlhttpexception
Open

matnun-br wants to merge 6 commits into
mainfrom
feat/add-errormsg-to-graphqlhttpexception

Conversation

@matnun-br

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Removing the public constructor breaks existing callers and compiled consumers, while ignoring configured JSON options when parsing HTTP errors can silently discard error messages.

2 open issues
What changed in this PR

This PR adds server-provided HTTP error messages to GraphQLHttpException, improving diagnostics for failed GraphQL requests.

Changes:

  • Adds an HTTP error model and a converter supporting string and message-object error formats.
  • Parses error details from unsuccessful HTTP responses, with a fallback for JSON parsing failures.
  • Includes extracted messages in the exception text.
File Description
GraphQLSharp/​Serialization/​GraphQLHttpErrorMessageConverter.cs Converts supported error formats into message lists.
GraphQLSharp/​Client/​Response/​GraphQLHttpError.cs Holds error messages and request/response context.
GraphQLSharp/​Client/​GraphQLClient.cs Reads HTTP error details before throwing an exception.
GraphQLSharp/​Client/​Exceptions/​GraphQLHttpException.cs Accepts the error model and includes messages in diagnostics.

Review effort: Balanced

Comment thread GraphQLSharp/Client/GraphQLClient.cs Resolved
@matnun-br matnun-br changed the title Feat/add errormsg to graphqlhttpexception Add error messages when available to GraphQLHttpException Nov 5, 2026
@matnun-br
matnun-br marked this pull request as ready for review November 5, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants