{"action":"created","comment":{"url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/comments/50089289","id":50089289,"diff_hunk":"@@ -714,13 +714,13 @@ Query.prototype.count = function(callback) {\n             return promisor._onExecuteResult(err);\n         }\n \n-        try {\n-            callback(undefined, result[0][\"COUNT(0)\"]);\n-            promisor._onExecuteResult(undefined, result[0][\"COUNT(0)\"]);\n-        } catch(e) {\n-            callback(undefined, 0);\n-            promisor._onExecuteResult(undefined, 0);\n+        var count = 0;\n+        if(result && result[0]) {\n+            count = parseInt(result[0][\"COUNT(0)\"]) || 0;","path":"lib/query.js","position":12,"original_position":12,"commit_id":"22ec1c26b700daea657e4c162ae7a50ca3c5e69c","original_commit_id":"22ec1c26b700daea657e4c162ae7a50ca3c5e69c","user":{"login":"plusmancn","id":4994682,"avatar_url":"https://avatars.githubusercontent.com/u/4994682?v=3","gravatar_id":"","url":"https://api.github.com/users/plusmancn","html_url":"https://github.com/plusmancn","followers_url":"https://api.github.com/users/plusmancn/followers","following_url":"https://api.github.com/users/plusmancn/following{/other_user}","gists_url":"https://api.github.com/users/plusmancn/gists{/gist_id}","starred_url":"https://api.github.com/users/plusmancn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plusmancn/subscriptions","organizations_url":"https://api.github.com/users/plusmancn/orgs","repos_url":"https://api.github.com/users/plusmancn/repos","events_url":"https://api.github.com/users/plusmancn/events{/privacy}","received_events_url":"https://api.github.com/users/plusmancn/received_events","type":"User","site_admin":false},"body":"@XadillaX 感觉在没有确定真实相等的情况下，还是不要做过多处理，会有意想不到的情况。","created_at":"2016-01-19T09:29:00Z","updated_at":"2016-01-19T09:29:00Z","html_url":"https://github.com/XadillaX/Toshihiko/pull/35#discussion_r50089289","pull_request_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/comments/50089289"},"html":{"href":"https://github.com/XadillaX/Toshihiko/pull/35#discussion_r50089289"},"pull_request":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35","id":56438158,"html_url":"https://github.com/XadillaX/Toshihiko/pull/35","diff_url":"https://github.com/XadillaX/Toshihiko/pull/35.diff","patch_url":"https://github.com/XadillaX/Toshihiko/pull/35.patch","issue_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/35","number":35,"state":"open","locked":false,"title":"Hotfix/#34","user":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"body":"`Model.count` 的时候，在 `callback` 函数里面 `throw Error` 会触发两次 `callback`。\r\n\r\n```javascript\r\nFoo.count(function(err, count) {\r\n    console.log(count);\r\n    throw Error('...');\r\n});\r\n```\r\n\r\n这段代码的 `callback` 会被多次触发。","created_at":"2016-01-19T09:07:35Z","updated_at":"2016-01-19T09:29:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23c17865d8423897748eeb4fa51f875fc4775a1d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35/commits","review_comments_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35/comments","review_comment_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/comments{/number}","comments_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/35/comments","statuses_url":"https://api.github.com/repos/XadillaX/Toshihiko/statuses/22ec1c26b700daea657e4c162ae7a50ca3c5e69c","head":{"label":"XadillaX:hotfix/#34","ref":"hotfix/#34","sha":"22ec1c26b700daea657e4c162ae7a50ca3c5e69c","user":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"repo":{"id":23830374,"name":"Toshihiko","full_name":"XadillaX/Toshihiko","owner":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/XadillaX/Toshihiko","description":":egg: A simple ORM for node.js in souche.com.","fork":false,"url":"https://api.github.com/repos/XadillaX/Toshihiko","forks_url":"https://api.github.com/repos/XadillaX/Toshihiko/forks","keys_url":"https://api.github.com/repos/XadillaX/Toshihiko/keys{/key_id}","collaborators_url":"https://api.github.com/repos/XadillaX/Toshihiko/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/XadillaX/Toshihiko/teams","hooks_url":"https://api.github.com/repos/XadillaX/Toshihiko/hooks","issue_events_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/events{/number}","events_url":"https://api.github.com/repos/XadillaX/Toshihiko/events","assignees_url":"https://api.github.com/repos/XadillaX/Toshihiko/assignees{/user}","branches_url":"https://api.github.com/repos/XadillaX/Toshihiko/branches{/branch}","tags_url":"https://api.github.com/repos/XadillaX/Toshihiko/tags","blobs_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/refs{/sha}","trees_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/trees{/sha}","statuses_url":"https://api.github.com/repos/XadillaX/Toshihiko/statuses/{sha}","languages_url":"https://api.github.com/repos/XadillaX/Toshihiko/languages","stargazers_url":"https://api.github.com/repos/XadillaX/Toshihiko/stargazers","contributors_url":"https://api.github.com/repos/XadillaX/Toshihiko/contributors","subscribers_url":"https://api.github.com/repos/XadillaX/Toshihiko/subscribers","subscription_url":"https://api.github.com/repos/XadillaX/Toshihiko/subscription","commits_url":"https://api.github.com/repos/XadillaX/Toshihiko/commits{/sha}","git_commits_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/commits{/sha}","comments_url":"https://api.github.com/repos/XadillaX/Toshihiko/comments{/number}","issue_comment_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/comments{/number}","contents_url":"https://api.github.com/repos/XadillaX/Toshihiko/contents/{+path}","compare_url":"https://api.github.com/repos/XadillaX/Toshihiko/compare/{base}...{head}","merges_url":"https://api.github.com/repos/XadillaX/Toshihiko/merges","archive_url":"https://api.github.com/repos/XadillaX/Toshihiko/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/XadillaX/Toshihiko/downloads","issues_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues{/number}","pulls_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls{/number}","milestones_url":"https://api.github.com/repos/XadillaX/Toshihiko/milestones{/number}","notifications_url":"https://api.github.com/repos/XadillaX/Toshihiko/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/XadillaX/Toshihiko/labels{/name}","releases_url":"https://api.github.com/repos/XadillaX/Toshihiko/releases{/id}","created_at":"2014-09-09T11:16:16Z","updated_at":"2016-01-17T17:50:44Z","pushed_at":"2016-01-19T09:07:35Z","git_url":"git://github.com/XadillaX/Toshihiko.git","ssh_url":"git@github.com:XadillaX/Toshihiko.git","clone_url":"https://github.com/XadillaX/Toshihiko.git","svn_url":"https://github.com/XadillaX/Toshihiko","homepage":"http://souche.com/","size":301,"stargazers_count":109,"watchers_count":109,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":2,"forks":15,"open_issues":2,"watchers":109,"default_branch":"develop"}},"base":{"label":"XadillaX:develop","ref":"develop","sha":"a4eeabb7fbabb91e7c1dec6b19ec4cf0e7d6d29d","user":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"repo":{"id":23830374,"name":"Toshihiko","full_name":"XadillaX/Toshihiko","owner":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/XadillaX/Toshihiko","description":":egg: A simple ORM for node.js in souche.com.","fork":false,"url":"https://api.github.com/repos/XadillaX/Toshihiko","forks_url":"https://api.github.com/repos/XadillaX/Toshihiko/forks","keys_url":"https://api.github.com/repos/XadillaX/Toshihiko/keys{/key_id}","collaborators_url":"https://api.github.com/repos/XadillaX/Toshihiko/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/XadillaX/Toshihiko/teams","hooks_url":"https://api.github.com/repos/XadillaX/Toshihiko/hooks","issue_events_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/events{/number}","events_url":"https://api.github.com/repos/XadillaX/Toshihiko/events","assignees_url":"https://api.github.com/repos/XadillaX/Toshihiko/assignees{/user}","branches_url":"https://api.github.com/repos/XadillaX/Toshihiko/branches{/branch}","tags_url":"https://api.github.com/repos/XadillaX/Toshihiko/tags","blobs_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/refs{/sha}","trees_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/trees{/sha}","statuses_url":"https://api.github.com/repos/XadillaX/Toshihiko/statuses/{sha}","languages_url":"https://api.github.com/repos/XadillaX/Toshihiko/languages","stargazers_url":"https://api.github.com/repos/XadillaX/Toshihiko/stargazers","contributors_url":"https://api.github.com/repos/XadillaX/Toshihiko/contributors","subscribers_url":"https://api.github.com/repos/XadillaX/Toshihiko/subscribers","subscription_url":"https://api.github.com/repos/XadillaX/Toshihiko/subscription","commits_url":"https://api.github.com/repos/XadillaX/Toshihiko/commits{/sha}","git_commits_url":"https://api.github.com/repos/XadillaX/Toshihiko/git/commits{/sha}","comments_url":"https://api.github.com/repos/XadillaX/Toshihiko/comments{/number}","issue_comment_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues/comments{/number}","contents_url":"https://api.github.com/repos/XadillaX/Toshihiko/contents/{+path}","compare_url":"https://api.github.com/repos/XadillaX/Toshihiko/compare/{base}...{head}","merges_url":"https://api.github.com/repos/XadillaX/Toshihiko/merges","archive_url":"https://api.github.com/repos/XadillaX/Toshihiko/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/XadillaX/Toshihiko/downloads","issues_url":"https://api.github.com/repos/XadillaX/Toshihiko/issues{/number}","pulls_url":"https://api.github.com/repos/XadillaX/Toshihiko/pulls{/number}","milestones_url":"https://api.github.com/repos/XadillaX/Toshihiko/milestones{/number}","notifications_url":"https://api.github.com/repos/XadillaX/Toshihiko/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/XadillaX/Toshihiko/labels{/name}","releases_url":"https://api.github.com/repos/XadillaX/Toshihiko/releases{/id}","created_at":"2014-09-09T11:16:16Z","updated_at":"2016-01-17T17:50:44Z","pushed_at":"2016-01-19T09:07:35Z","git_url":"git://github.com/XadillaX/Toshihiko.git","ssh_url":"git@github.com:XadillaX/Toshihiko.git","clone_url":"https://github.com/XadillaX/Toshihiko.git","svn_url":"https://github.com/XadillaX/Toshihiko","homepage":"http://souche.com/","size":301,"stargazers_count":109,"watchers_count":109,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":2,"forks":15,"open_issues":2,"watchers":109,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35"},"html":{"href":"https://github.com/XadillaX/Toshihiko/pull/35"},"issue":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/issues/35"},"comments":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/XadillaX/Toshihiko/statuses/22ec1c26b700daea657e4c162ae7a50ca3c5e69c"}}}}