dotansimha / dotansimha/graphql-code-generator-community

typescript-react-query error handling

Open
#211 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Describe the bug

The error field only contains 'message' of the first error instead the whole error array, extensions are also missing.

The error field should contain something like this:

`export type GraphQLError = { message: string, extensions?: GraphQLErrorExtensions }
export type GraphQLErrorExtensions = { path?: string, code?: string }`

### Your Example Website or App

-

### Steps to Reproduce the Bug or Issue

This part in the fetcher should get fixed:

` const json = await res.json();

if (json.errors) {
const { message } = json.errors[0];

throw new Error(message);
}`

### Expected behavior

Graphql standard errors array should be set.

### Screenshots or Videos

_No response_

### Platform

Docker

### Codegen Config File

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the fetcher code shown in the issue and read how the JSON response's errors field is parsed. Verify the GraphQL error response shape and update the behavior so the complete errors array, including extensions, is preserved; the issue does not name a test, so confirm the result against the reproduction and expected behavior described here.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.