Giter VIP home page Giter VIP logo

Comments (6)

spawnia avatar spawnia commented on July 19, 2024 1

@olivernybroe can this be closed as of #235 ?

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024

Hi @olivernybroe,
Im not aware of what you mean, i know you can overwrite the error function, just been added to the repo on latest commits.
I personally, working with react, im able to process exceptions errors, 500, all, as it comes with no additional setup.

Could you provide more info?

from lighthouse.

olivernybroe avatar olivernybroe commented on July 19, 2024

@kikoseijo Oh If I can overwrite the error function then I can prob. just implement it myself.

But what I mean is in Laravel when I implement the Responsable interface, Laravel will render my exception accordingly to the toResponse($request) method.
I for example like throwing exceptions when something is wrong and then handling them in the exceptionshandler and render them to the front end with the toResponse($request) method.

So my proposal is to have an interface like this, but just for rendering the exception for the errors array in graphql.

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024

I wonder if this is posible,
but i guess the Graphql has a try-catch and does its own thing.

Maybe this helps you:

https://github.com/nuwave/lighthouse/blob/882a1b21508f60fcadb21ec7b8bdc320a270a649/src/Support/Traits/CanFormatError.php

from lighthouse.

spawnia avatar spawnia commented on July 19, 2024

Hey @olivernybroe

Would this help with error messages such as this? It would be nice to have errors as JSON to directly view them in one of the GraphQL tools. Often, i end up copy-pasting the query out of there and calling it directly in the browser to see the error output.

42065867-5d3ba150-7af2-11e8-8c8f-70b540d3039c

from lighthouse.

olivernybroe avatar olivernybroe commented on July 19, 2024

@spawnia that is another problem, but not the one I am trying to solve here. I merely won't to implement a interface on my exception class, and if this interface exists, then a specific method on the exception tells how to render the exception in the errors array on the output.

from lighthouse.

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.