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

feat(Query) run after_query hooks even if an error occurs #412

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

rmosolgo
Copy link
Owner

With this change, after_query hooks are always run, even if the query raises a Runtime error

@rmosolgo
Copy link
Owner Author

(I did this with graphql-batch in mind, but it's a good move either way!)

@@ -254,6 +254,7 @@ def initialize(query, instrumenters)
def call
@instrumenters.each { |i| i.before_query(@query) }
result = get_result
ensure
@instrumenters.each { |i| i.after_query(@query) }
result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line and the result = assignment above isn't needed, since the result of the ensure block isn't returned.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Thanks, fixed in 84143b7

@rmosolgo rmosolgo modified the milestone: 1.2.5 Nov 22, 2016
rmosolgo added a commit that referenced this pull request Nov 22, 2016
feat(Query) run after_query hooks even if an error occurs
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

Successfully merging this pull request may close these issues.

2 participants