Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws an ApiError with error extensions #601

Merged
merged 1 commit into from
May 4, 2022

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.

GraphQL client can use extensions.type to get the error type
@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.

None yet

1 participant