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

Is error reporting broken? #25

Closed
hipsterjazzbo opened this issue Jul 23, 2018 · 2 comments
Closed

Is error reporting broken? #25

hipsterjazzbo opened this issue Jul 23, 2018 · 2 comments

Comments

@hipsterjazzbo
Copy link
Contributor

When some of my code throws an \Error or \Exception, the error I get back includes a "location", but no indication of where the error occurred — no file, or class name, or trace.

Is this by design? Could we do something like this in formatError()?

if (!empty($prev)) {
	if ($prev instanceof ValidationError) {
		$error['validation'] = $prev->getValidatorMessages()->toArray();
	} else if ($prev instanceof \Throwable) {
	    // Throw in the trace so one can know where an exception occurred
            $error['trace'] = explode("\n", $prev->getTraceAsString());
        }
}

That would give us a nicely formatted trace back to where the original \Throwable was thrown, so the error is findable (though it should probably be switched based on env(APP_DEBUG))

@cmizzi
Copy link
Contributor

cmizzi commented Aug 6, 2018

I tried to manage error handling directly in the package, but https://github.com/webonyx/graphql-php seems to handle it own. I need to read the code/documentation to manage that.

http://webonyx.github.io/graphql-php/error-handling/

cmizzi pushed a commit that referenced this issue Sep 24, 2018
cmizzi pushed a commit that referenced this issue Sep 24, 2018
@cmizzi
Copy link
Contributor

cmizzi commented Sep 24, 2018

Sorry for the delay.

Now, we got a real exception handler. It simply manage exception as real exception (thrown from GraphQL) and debug informations if the debug mode is on.

@cmizzi cmizzi closed this as completed Sep 24, 2018
drasill pushed a commit that referenced this issue Nov 29, 2018
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

2 participants