Code Monkey home page Code Monkey logo

Comments (4)

pyrossh avatar pyrossh commented on July 24, 2024

Also it seems if an error occurs in the context function. It crashes the server. Currently my context function is async and checks the token. It would be great if could try to catch an error happening here and return it as a graphql error.

from graphql-yoga.

orefalo avatar orefalo commented on July 24, 2024

+1 same issue

On the implementation, I think you can better structure the Option type. Also a log level is better than a boolean.

  • formatError?: Function
  • formatParams?: Function
  • formatResponse?: Function
  • logFunction?: LogFunction
  • debug?: boolean

from graphql-yoga.

pyrossh avatar pyrossh commented on July 24, 2024

I've removed the debug option. I've put these new params in the props will/should it be in the options or should it be in a new field called apollo which will expose all low level apollo server options.

export interface Props {
  typeDefs?: string
  resolvers?: IResolvers
  schema?: GraphQLSchema
  context?: Context | ContextCallback
  options?: Options
  formatError?: Function
  formatParams?: Function
  formatResponse?: Function
  logFunction?: LogFunction
}

from graphql-yoga.

Urigo avatar Urigo commented on July 24, 2024

Hey, @Urigo from The Guild here!

You might know us from projects such as graphql-code-generator, envelop or graphql-tools.

For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server.

In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀

And regarding the issue here, Yoga uses the Envelop plugin system under the hood which has a very powerful hooks system and a whole ecosystem of plugins, including error handling plugins:

https://www.envelop.dev/plugins
https://www.the-guild.dev/blog/graphql-error-handling-with-fp

We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here.
Thank you all for your feedback and suggestions, you made this release possible!

Please try Yoga out again, give us feedback and help us spread the word on the new release!

from graphql-yoga.

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.