You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
4XX or 5XX HTTP error codes are throwing errors when using axios. But this is not always the wanted behavior in a GraphQL schema. This is especially true for 404 errors that shouldn't throw but return null in a GraphQL resolver.
One can use withDefault404Result(promise, defaultResult) from node_modules/front-commerce/src/server/core/graphql/queryResponseBuilders.js to handle such case.
For instance, if you want to fetch a product but return null, you could do :
4XX or 5XX HTTP error codes are throwing errors when using axios. But this is not always the wanted behavior in a GraphQL schema. This is especially true for 404 errors that shouldn't throw but return
null
in a GraphQL resolver.One can use
withDefault404Result(promise, defaultResult)
fromnode_modules/front-commerce/src/server/core/graphql/queryResponseBuilders.js
to handle such case.For instance, if you want to fetch a product but return null, you could do :
The text was updated successfully, but these errors were encountered: