{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/comments/53242477","id":53242477,"diff_hunk":"@@ -49,7 +49,13 @@ def each_promise_in_entry(obj, key, value, &block)\n     class FieldResolution < GraphQL::Query::SerialExecution::FieldResolution\n       def get_finished_value(raw_value)\n         if raw_value.is_a?(::Promise)\n-          raw_value.then { |result| super(result) }\n+          on_reject = lambda do |error|\n+            raise error unless error.is_a?(GraphQL::ExecutionError)\n+            error.ast_node = ast_node\n+            query.context.errors << error","path":"lib/graphql/batch/execution_strategy.rb","position":8,"original_position":8,"commit_id":"09d0de797db2c2e0f20f83c4b56253861ce0840e","original_commit_id":"09d0de797db2c2e0f20f83c4b56253861ce0840e","user":{"login":"dylanahsmith","id":954402,"avatar_url":"https://avatars.githubusercontent.com/u/954402?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanahsmith","html_url":"https://github.com/dylanahsmith","followers_url":"https://api.github.com/users/dylanahsmith/followers","following_url":"https://api.github.com/users/dylanahsmith/following{/other_user}","gists_url":"https://api.github.com/users/dylanahsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanahsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanahsmith/subscriptions","organizations_url":"https://api.github.com/users/dylanahsmith/orgs","repos_url":"https://api.github.com/users/dylanahsmith/repos","events_url":"https://api.github.com/users/dylanahsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dylanahsmith/received_events","type":"User","site_admin":false},"body":"Perhaps this could be done in the upstream get_finished_value if a GraphQL::ExecutionError instance is passed into it instead of doing this in the result method upstream.","created_at":"2016-02-17T22:32:05Z","updated_at":"2016-02-17T22:32:05Z","html_url":"https://github.com/Shopify/graphql-batch/pull/5#discussion_r53242477","pull_request_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/comments/53242477"},"html":{"href":"https://github.com/Shopify/graphql-batch/pull/5#discussion_r53242477"},"pull_request":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5","id":59719670,"html_url":"https://github.com/Shopify/graphql-batch/pull/5","diff_url":"https://github.com/Shopify/graphql-batch/pull/5.diff","patch_url":"https://github.com/Shopify/graphql-batch/pull/5.patch","issue_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/5","number":5,"state":"open","locked":false,"title":"Improve error handling","user":{"login":"dylanahsmith","id":954402,"avatar_url":"https://avatars.githubusercontent.com/u/954402?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanahsmith","html_url":"https://github.com/dylanahsmith","followers_url":"https://api.github.com/users/dylanahsmith/followers","following_url":"https://api.github.com/users/dylanahsmith/following{/other_user}","gists_url":"https://api.github.com/users/dylanahsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanahsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanahsmith/subscriptions","organizations_url":"https://api.github.com/users/dylanahsmith/orgs","repos_url":"https://api.github.com/users/dylanahsmith/repos","events_url":"https://api.github.com/users/dylanahsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dylanahsmith/received_events","type":"User","site_admin":false},"body":"@eapache for review\r\n\r\n## Problem\r\n\r\nI noticed a problem with the RecordLoader example in the README when records were missing.  We weren't fulfilling the load for ids if they are missing in the query result.\r\n\r\nWhen we do come across a bug in a loader, we should also make these errors easier to debug by checking for unfulfilled promises in the loader and in the executor to provide a helpful error message.\r\n\r\nI also noticed that we aren't actually handling a GraphQL::ExecutionError properly, since it wasn't behaving as if the error was raised in a field's resolve proc.  The error was causing the whole request to fail, without showing other fields, instead of being treated as a field error.\r\n\r\n## Solution\r\n\r\n* I added `GraphQL::Batch::Loader#fulfilled?` to make it easier to check for unfulfilled promises in `#perform`\r\n* GraphQL::Batch::Loader#resolve now raises GraphQL::Batch::BrokenPromiseError if a promise is still pending after `#perform`\r\n* GraphQL::Batch::Executor#wait now raises GraphQL::Batch::BrokenPromiseError if the promise is still pending after all loads have been performed\r\n* I added an on_reject handler in the get_finished_value override in the execution strategy","created_at":"2016-02-17T22:28:43Z","updated_at":"2016-02-17T22:32:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c950ae1fe5f1d66238756b20a78ebfe8a6f43cc9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5/commits","review_comments_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5/comments","review_comment_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/5/comments","statuses_url":"https://api.github.com/repos/Shopify/graphql-batch/statuses/09d0de797db2c2e0f20f83c4b56253861ce0840e","head":{"label":"Shopify:error-handling","ref":"error-handling","sha":"09d0de797db2c2e0f20f83c4b56253861ce0840e","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":42800785,"name":"graphql-batch","full_name":"Shopify/graphql-batch","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/graphql-batch","description":"A query batching executor for the graphql gem","fork":false,"url":"https://api.github.com/repos/Shopify/graphql-batch","forks_url":"https://api.github.com/repos/Shopify/graphql-batch/forks","keys_url":"https://api.github.com/repos/Shopify/graphql-batch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/graphql-batch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/graphql-batch/teams","hooks_url":"https://api.github.com/repos/Shopify/graphql-batch/hooks","issue_events_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/graphql-batch/events","assignees_url":"https://api.github.com/repos/Shopify/graphql-batch/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/graphql-batch/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/graphql-batch/tags","blobs_url":"https://api.github.com/repos/Shopify/graphql-batch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/graphql-batch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/graphql-batch/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/graphql-batch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/graphql-batch/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/graphql-batch/languages","stargazers_url":"https://api.github.com/repos/Shopify/graphql-batch/stargazers","contributors_url":"https://api.github.com/repos/Shopify/graphql-batch/contributors","subscribers_url":"https://api.github.com/repos/Shopify/graphql-batch/subscribers","subscription_url":"https://api.github.com/repos/Shopify/graphql-batch/subscription","commits_url":"https://api.github.com/repos/Shopify/graphql-batch/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/graphql-batch/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/graphql-batch/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/graphql-batch/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/graphql-batch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/graphql-batch/merges","archive_url":"https://api.github.com/repos/Shopify/graphql-batch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/graphql-batch/downloads","issues_url":"https://api.github.com/repos/Shopify/graphql-batch/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/graphql-batch/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/graphql-batch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/graphql-batch/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/graphql-batch/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/graphql-batch/deployments","created_at":"2015-09-20T04:57:22Z","updated_at":"2016-02-13T09:12:32Z","pushed_at":"2016-02-17T22:28:43Z","git_url":"git://github.com/Shopify/graphql-batch.git","ssh_url":"git@github.com:Shopify/graphql-batch.git","clone_url":"https://github.com/Shopify/graphql-batch.git","svn_url":"https://github.com/Shopify/graphql-batch","homepage":null,"size":34,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":15,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"4bb24bed6d0dfbc56634b11da83703b8132b9a31","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":42800785,"name":"graphql-batch","full_name":"Shopify/graphql-batch","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/graphql-batch","description":"A query batching executor for the graphql gem","fork":false,"url":"https://api.github.com/repos/Shopify/graphql-batch","forks_url":"https://api.github.com/repos/Shopify/graphql-batch/forks","keys_url":"https://api.github.com/repos/Shopify/graphql-batch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/graphql-batch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/graphql-batch/teams","hooks_url":"https://api.github.com/repos/Shopify/graphql-batch/hooks","issue_events_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/graphql-batch/events","assignees_url":"https://api.github.com/repos/Shopify/graphql-batch/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/graphql-batch/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/graphql-batch/tags","blobs_url":"https://api.github.com/repos/Shopify/graphql-batch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/graphql-batch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/graphql-batch/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/graphql-batch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/graphql-batch/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/graphql-batch/languages","stargazers_url":"https://api.github.com/repos/Shopify/graphql-batch/stargazers","contributors_url":"https://api.github.com/repos/Shopify/graphql-batch/contributors","subscribers_url":"https://api.github.com/repos/Shopify/graphql-batch/subscribers","subscription_url":"https://api.github.com/repos/Shopify/graphql-batch/subscription","commits_url":"https://api.github.com/repos/Shopify/graphql-batch/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/graphql-batch/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/graphql-batch/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/graphql-batch/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/graphql-batch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/graphql-batch/merges","archive_url":"https://api.github.com/repos/Shopify/graphql-batch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/graphql-batch/downloads","issues_url":"https://api.github.com/repos/Shopify/graphql-batch/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/graphql-batch/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/graphql-batch/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/graphql-batch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/graphql-batch/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/graphql-batch/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/graphql-batch/deployments","created_at":"2015-09-20T04:57:22Z","updated_at":"2016-02-13T09:12:32Z","pushed_at":"2016-02-17T22:28:43Z","git_url":"git://github.com/Shopify/graphql-batch.git","ssh_url":"git@github.com:Shopify/graphql-batch.git","clone_url":"https://github.com/Shopify/graphql-batch.git","svn_url":"https://github.com/Shopify/graphql-batch","homepage":null,"size":34,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5"},"html":{"href":"https://github.com/Shopify/graphql-batch/pull/5"},"issue":{"href":"https://api.github.com/repos/Shopify/graphql-batch/issues/5"},"comments":{"href":"https://api.github.com/repos/Shopify/graphql-batch/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/graphql-batch/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/graphql-batch/statuses/09d0de797db2c2e0f20f83c4b56253861ce0840e"}}}}