Coder Social home page Coder Social logo

Comments (4)

Cito avatar Cito commented on July 29, 2024 5

@ceelian - thanks for the feedback. Changeset e0bb443 should improve this.

Here is an example how you can get error tracebacks now:

from traceback import print_tb
from graphql import *

def bad_resolver(obj, info):
    raise RuntimeError("the runtime error")

schema = GraphQLSchema(query=GraphQLObjectType(
    name='RootQueryType',
    fields={'bad': GraphQLField(GraphQLString, resolve=bad_resolver)}))

error = graphql_sync(schema, '{ bad }').errors[0]
original_error = error.original_error

print(error)
print_tb(error.__traceback__)

Output:

the runtime error

GraphQL request (1:3)
1: { bad }
     ^

  File ".../execute.py", line 664, in complete_value_catching_error
    return_type, field_nodes, info, path, result
  File ".../execute.py", line 731, in complete_value
    raise result
  File "../execute.py", line 619, in resolve_field_value_or_error
    result = resolve_fn(source, info, **args)
  File "test_graphql.py", line 7, in bad_resolver
    raise RuntimeError("the runtime error")

Will release an upate with this improvement soon.

from graphql-core.

Cito avatar Cito commented on July 29, 2024 3

Version 1.0,2 with this fix has now been released on PyPI.

from graphql-core.

ceelian avatar ceelian commented on July 29, 2024

Great, thank you for the improvement!

from graphql-core.

ezyang avatar ezyang commented on July 29, 2024

Thank you, I was affected by this too.

from graphql-core.

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.