Skip to content

fix(core): include GraphQL error messages in CombinedError.message when a networkError is also present - #3911

Open
usamabhatti1998 wants to merge 1 commit into
urql-graphql:mainfrom
usamabhatti1998:fix/combined-error-both-messages
Open

usamabhatti1998 wants to merge 1 commit into
urql-graphql:mainfrom
usamabhatti1998:fix/combined-error-both-messages

Conversation

@usamabhatti1998

Copy link
Copy Markdown

Summary

CombinedError's message generator (generateErrorMessage) returns early as soon as a networkError is present, so if a CombinedError ever carries both a networkError and graphQLErrors (this happens for real after an SSR round-trip through ssrExchange's serializeResult/deserializeResult, since both fields are serialized independently), every GraphQL error message is silently dropped from .message/\${error}`. The structured .graphQLErrors` array was always correct — only the human-readable message lost data.

Set of changes

  • packages/core/src/utils/error.ts: stop short-circuiting on networkErr in generateErrorMessage; append its message and fall through to the existing GraphQL-error loop instead.
  • packages/core/src/utils/error.test.ts: add a test covering both error types being present simultaneously.
  • Added a changeset (patch on @urql/core).

Not a breaking change — behavior for network-only and GraphQL-only errors (the two cases every existing test covers) is byte-for-byte identical; only the previously-untested "both present" case changes, from silently dropping data to including it.

@changeset-bot

changeset-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7b1ce7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@urql/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant