-
Notifications
You must be signed in to change notification settings - Fork 160
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
Remove catching of exceptions inside field resolver functions #86
Conversation
# Conflicts: # CHANGES.md # src/com/walmartlabs/lacinia/schema.clj
Would it be simpler to not catch exceptions at all and let users handle them however they want? |
Given the mea culpa on decorators, that's worth considering. But still, this feels like something that will be applied uniformly across resolvers. The existing code catches the exception, converts to an error map, and adds to the error map a number of keys to identify the source in the query document of the failure. Perhaps we could see about stripping that out, so that an exception simply bubbles up, and probably gets caught back inside the Pedestal interceptor chain. |
The only potential problem I see here is async resolvers. Not sure how exceptions will propagate in async world. |
The docs on async are already very specific about exceptions: catch them or your system will grind to a halt. |
Side note: the need to capture field resolver exceptions dates back to much earlier Lacinia, before the introduction of ResolverResult. With this change, the main execution flow has no try/catch at all (there's some in parsing and validation). |
Fixes #82 -- in the current form, the exception capturing is very aggressive, gets in the way of debugging when things go wrong.