Skip to content

Conversation

ggrossetie
Copy link
Collaborator

GraphQL client can use extensions.type to get the error type

@ggrossetie
Copy link
Collaborator Author

Cela permet notamment de réduire les "erreurs" quand le client GraphQL du service d'export tente de récupérer une version ou un article qui n'existe pas.

On pourrait aussi retourner une 404 mais j'ai l'impression que ce n'est pas trop dans les recommandations GraphQL: graphql/express-graphql#111 (comment)

J'ai trouvé plusieurs articles qui décrivent l'utilisation d'erreurs avec extensions:

L'alternative c'est de dire que article ou version est optionnel dans le schéma et de retourner null. Je n'ai pas opté pour cette solution car null n'est pas parlant et peu avoir plusieurs significations.

@ggrossetie ggrossetie requested a review from thom4parisot March 23, 2022 11:56
@ggrossetie ggrossetie force-pushed the graphql-error-extensions branch from c3d00c6 to 7dfd754 Compare May 4, 2022 07:25
GraphQL client can use extensions.type to get the error type
@ggrossetie ggrossetie force-pushed the graphql-error-extensions branch from 7dfd754 to 5afe2b8 Compare May 4, 2022 07:26
@netlify
Copy link

netlify bot commented May 4, 2022

Deploy Preview for stylo-dev ready!

Name Link
🔨 Latest commit 7dfd754
🔍 Latest deploy log https://app.netlify.com/sites/stylo-dev/deploys/62722a77b5693500080774e9
😎 Deploy Preview https://deploy-preview-601--stylo-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ggrossetie ggrossetie merged commit eb93b0c into master May 4, 2022
@ggrossetie ggrossetie deleted the graphql-error-extensions branch May 4, 2022 07:27
@netlify
Copy link

netlify bot commented May 4, 2022

Deploy Preview for stylo-dev ready!

Name Link
🔨 Latest commit 5afe2b8
🔍 Latest deploy log https://app.netlify.com/sites/stylo-dev/deploys/62722aa4e349f30007e80f0b
😎 Deploy Preview https://deploy-preview-601--stylo-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

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