graphql-editor / graphql-zeus

GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚡⚡⚡ for browser,nodejs and react native ( apollo compatible )
https://graphqleditor.com/docs/zeus
MIT License
1.95k stars 106 forks source link

Zeus throws objects as errors #387

Open smcgivern opened 12 months ago

smcgivern commented 12 months ago

If a response from the server isn't OK, handleFetchResponse will reject the promise (throwing an error) with the JSON-parsed version of the response: https://github.com/graphql-editor/graphql-zeus/blob/cfd6d58cc4d08131ba80e67c8b098856eca7a83d/packages/graphql-zeus-core/TreeToTS/functions/new/apiFetch.ts#L10

This seems like it would either be better off as a GraphQLError, or a different type. Throwing an object as an error is a bit confusing for callers (see https://github.com/graphql/graphql-js/issues/1393, for example).