Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging Panic Stack Trace #64

Open
johndww opened this issue Feb 1, 2019 · 2 comments
Open

Logging Panic Stack Trace #64

johndww opened this issue Feb 1, 2019 · 2 comments

Comments

@johndww
Copy link

johndww commented Feb 1, 2019

I'm looking to be able to log a stack trace when one of my field resolvers panics.

Currently, I get something like this:

        { "query": "query AllAttributes() {attributes(key: $value) {names}}", "variables": {}  } 
        
         [
        	{
        		"message": "runtime error: invalid memory address or nil pointer dereference",
        		"locations": []
        	}
        ]

I've tried to FormatErrorFn which works well for regular errors that get bubbled up, but by the time it gets triggered, the panic's stack trace is missing. I believe the defer-recover function in executor.go completeValueCatchingError would need to capture the stack in debug.Stack() and stash it on the gqlerrors.Error.

I'm happy to attempt to implement it and open a PR, but I'd like to make sure I wasn't missing something first.

@PacoDw
Copy link

PacoDw commented Jan 5, 2021

I have the same issue. It would be nice if this implementation is implemented :)

In the meantime, did you find a solution to show the stack trace?

@Bjohnson131
Copy link

Hello, has this been implemented with #423? Is there an example of returning the stack when a nil pointer deref is hit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants