GithubHelp home page GithubHelp logo

Comments (8)

mcg-web avatar mcg-web commented on May 28, 2024

Hi,

We don't use http status code because in graphQL response can be partially successful. What is the code for this case?... The approach is much different than rest api because you can request many resources in an unique query... It is not recommend but if you want to use it in your app you can create a custom controller here the way was doing this at the beginning of this bundle.

from graphqlbundle.

ooflorent avatar ooflorent commented on May 28, 2024

Previously we were returning HTTP error codes but we found it counter-productive. GraphQL is not REST. In REST, error codes are part of the response. They have a useful meaning. In GraphQL the response is the JSON payload, not the HTTP error code.

The JS implementation has 4 possible error codes:

  • 200: everything is fine
  • 400: the GraphQL request has failed
  • 405: the HTTP request is neither GET nor POST
  • 500: unhandled server error

Maybe we could use 400 error code again. We rolled-back this change because it was causing troubles with react-relay.

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

So here comes a new challenger :trollface: ! We can implement this 4 error codes in the bundle, or just give the ability of configuring them in each case 🤔.

from graphqlbundle.

benatespina avatar benatespina commented on May 28, 2024

It would be nice if we had a status code inside the error. Before "message" key for example.

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

we can't touch the errors format but adding http status codes like the express integration is possible. I'll try to work on a POC this week-end...

from graphqlbundle.

renatomefi avatar renatomefi commented on May 28, 2024

@mcg-web do you have some material/links to support this? Maybe someone else can pick this up!

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

just re-implementing this can be sufficient right now (with some tests to cover it)... maybe the JS implementation can help on this...

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

This will not be implement server side cause this conflicting with major clients like Apollo http error. Anyway you can use error formatting to add information to errors...

from graphqlbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.