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

Exception catching is too aggressive #82

Closed
geremih opened this issue Jun 14, 2017 · 3 comments
Closed

Exception catching is too aggressive #82

geremih opened this issue Jun 14, 2017 · 3 comments
Milestone

Comments

@geremih
Copy link

geremih commented Jun 14, 2017

In the current implementation, any exception thrown by a field-resolver is caught by execute and only the message is passed through. I had to checkout the repo and remove all the catch statement to find the issue in my code. Would it be possible to have an option to toggle the verbosity of the errors, or whether to throw them or not?

The error in my case was because the keys in the variables I was passing in were strings and lacinia was expecting keywords, which led to NullPointer exceptions down the line.

@hlship
Copy link
Member

hlship commented Jun 16, 2017

What I'm personally hoping to avoid is having to hook in a logging library. We could put more of the exception data into the error map, but that ends up being too verbose, and somewhat insecure (leaking implementation details to an unknown client). I don't think I like the idea of an exception callback, so that loops me back to logging.

@geremih
Copy link
Author

geremih commented Jun 16, 2017

@hlship
What's the reason behind not liking exception callbacks? It allows the user to specify how to handle exceptions and at the same time lets lacinia return errors that conform to the spec.
Cheaper alternatives would be to not catch the exceptions and have the user handle it along with spec compliance. Also, implementation details are already being leaked in the form of exception messages (less insecure than a full blown trace, but still).

@hlship
Copy link
Member

hlship commented Jun 16, 2017

Maybe something like an exception sanitizer callback that could be passed some information about where the exception occured, and the real exception, and is expected to return an error map.

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

No branches or pull requests

2 participants