{"action":"created","comment":{"url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/comments/36187233","id":36187233,"diff_hunk":"@@ -159,11 +161,11 @@ WalletService.getInstanceWithAuth = function(opts, cb) {\n   var server = new WalletService();\n   server.storage.fetchCopayerLookup(opts.copayerId, function(err, copayer) {\n     if (err) return cb(err);\n-    if (!copayer) return cb(new ClientError('NOTAUTHORIZED', 'Copayer not found'));\n+    if (!copayer) return cb(new ClientError(Errors.codes.NOT_AUTHORIZED, 'Copayer not found'));","path":"lib/server.js","position":16,"original_position":16,"commit_id":"e1fac88a8e7850001f5e4878396deb0da4d40a04","original_commit_id":"e1fac88a8e7850001f5e4878396deb0da4d40a04","user":{"login":"isocolsky","id":2073468,"avatar_url":"https://avatars.githubusercontent.com/u/2073468?v=3","gravatar_id":"","url":"https://api.github.com/users/isocolsky","html_url":"https://github.com/isocolsky","followers_url":"https://api.github.com/users/isocolsky/followers","following_url":"https://api.github.com/users/isocolsky/following{/other_user}","gists_url":"https://api.github.com/users/isocolsky/gists{/gist_id}","starred_url":"https://api.github.com/users/isocolsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocolsky/subscriptions","organizations_url":"https://api.github.com/users/isocolsky/orgs","repos_url":"https://api.github.com/users/isocolsky/repos","events_url":"https://api.github.com/users/isocolsky/events{/privacy}","received_events_url":"https://api.github.com/users/isocolsky/received_events","type":"User","site_admin":false},"body":"Glad you bring this up. The `getInstanceWithAuth` method could return a `NOT_AUTHORIZED` error based on two conditions: `Copayer not found` and `Invalid signature`. Since this is a rather special code (see https://github.com/bitpay/bitcore-wallet-service/blob/master/lib/expressapp.js#L72) I was hesitant to create two separate errors for this (e.g. `COPAYER_NOT_FOUND` & `INVALID_SIGNATURE`) which would have been more in line with the rest of the code.\r\nDo you have suggestions to improve this and make error handling less complex?","created_at":"2015-08-04T13:32:17Z","updated_at":"2015-08-04T13:32:17Z","html_url":"https://github.com/bitpay/bitcore-wallet-service/pull/307#discussion_r36187233","pull_request_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307","_links":{"self":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/comments/36187233"},"html":{"href":"https://github.com/bitpay/bitcore-wallet-service/pull/307#discussion_r36187233"},"pull_request":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307"}}},"pull_request":{"url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307","id":41349846,"html_url":"https://github.com/bitpay/bitcore-wallet-service/pull/307","diff_url":"https://github.com/bitpay/bitcore-wallet-service/pull/307.diff","patch_url":"https://github.com/bitpay/bitcore-wallet-service/pull/307.patch","issue_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/307","number":307,"state":"open","locked":false,"title":"Ref/error codes","user":{"login":"isocolsky","id":2073468,"avatar_url":"https://avatars.githubusercontent.com/u/2073468?v=3","gravatar_id":"","url":"https://api.github.com/users/isocolsky","html_url":"https://github.com/isocolsky","followers_url":"https://api.github.com/users/isocolsky/followers","following_url":"https://api.github.com/users/isocolsky/following{/other_user}","gists_url":"https://api.github.com/users/isocolsky/gists{/gist_id}","starred_url":"https://api.github.com/users/isocolsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocolsky/subscriptions","organizations_url":"https://api.github.com/users/isocolsky/orgs","repos_url":"https://api.github.com/users/isocolsky/repos","events_url":"https://api.github.com/users/isocolsky/events{/privacy}","received_events_url":"https://api.github.com/users/isocolsky/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-31T15:17:42Z","updated_at":"2015-08-04T13:32:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f68b761f6b3b2b21d7e285bddd5226bd4602181","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307/commits","review_comments_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307/comments","review_comment_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/307/comments","statuses_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/statuses/e1fac88a8e7850001f5e4878396deb0da4d40a04","head":{"label":"isocolsky:ref/error_codes","ref":"ref/error_codes","sha":"e1fac88a8e7850001f5e4878396deb0da4d40a04","user":{"login":"isocolsky","id":2073468,"avatar_url":"https://avatars.githubusercontent.com/u/2073468?v=3","gravatar_id":"","url":"https://api.github.com/users/isocolsky","html_url":"https://github.com/isocolsky","followers_url":"https://api.github.com/users/isocolsky/followers","following_url":"https://api.github.com/users/isocolsky/following{/other_user}","gists_url":"https://api.github.com/users/isocolsky/gists{/gist_id}","starred_url":"https://api.github.com/users/isocolsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocolsky/subscriptions","organizations_url":"https://api.github.com/users/isocolsky/orgs","repos_url":"https://api.github.com/users/isocolsky/repos","events_url":"https://api.github.com/users/isocolsky/events{/privacy}","received_events_url":"https://api.github.com/users/isocolsky/received_events","type":"User","site_admin":false},"repo":{"id":31481364,"name":"bitcore-wallet-service","full_name":"isocolsky/bitcore-wallet-service","owner":{"login":"isocolsky","id":2073468,"avatar_url":"https://avatars.githubusercontent.com/u/2073468?v=3","gravatar_id":"","url":"https://api.github.com/users/isocolsky","html_url":"https://github.com/isocolsky","followers_url":"https://api.github.com/users/isocolsky/followers","following_url":"https://api.github.com/users/isocolsky/following{/other_user}","gists_url":"https://api.github.com/users/isocolsky/gists{/gist_id}","starred_url":"https://api.github.com/users/isocolsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocolsky/subscriptions","organizations_url":"https://api.github.com/users/isocolsky/orgs","repos_url":"https://api.github.com/users/isocolsky/repos","events_url":"https://api.github.com/users/isocolsky/events{/privacy}","received_events_url":"https://api.github.com/users/isocolsky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isocolsky/bitcore-wallet-service","description":"Copay server","fork":true,"url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service","forks_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/forks","keys_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/teams","hooks_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/hooks","issue_events_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/issues/events{/number}","events_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/events","assignees_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/assignees{/user}","branches_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/branches{/branch}","tags_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/tags","blobs_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/statuses/{sha}","languages_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/languages","stargazers_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/stargazers","contributors_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/contributors","subscribers_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/subscribers","subscription_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/subscription","commits_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/contents/{+path}","compare_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/merges","archive_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/downloads","issues_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/issues{/number}","pulls_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/pulls{/number}","milestones_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/milestones{/number}","notifications_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/labels{/name}","releases_url":"https://api.github.com/repos/isocolsky/bitcore-wallet-service/releases{/id}","created_at":"2015-03-01T00:03:45Z","updated_at":"2015-03-01T00:03:46Z","pushed_at":"2015-08-03T19:11:28Z","git_url":"git://github.com/isocolsky/bitcore-wallet-service.git","ssh_url":"git@github.com:isocolsky/bitcore-wallet-service.git","clone_url":"https://github.com/isocolsky/bitcore-wallet-service.git","svn_url":"https://github.com/isocolsky/bitcore-wallet-service","homepage":null,"size":1968,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bitpay:master","ref":"master","sha":"362d1a42bb28bede2e16d437aad17b41c7c1017c","user":{"login":"bitpay","id":2554930,"avatar_url":"https://avatars.githubusercontent.com/u/2554930?v=3","gravatar_id":"","url":"https://api.github.com/users/bitpay","html_url":"https://github.com/bitpay","followers_url":"https://api.github.com/users/bitpay/followers","following_url":"https://api.github.com/users/bitpay/following{/other_user}","gists_url":"https://api.github.com/users/bitpay/gists{/gist_id}","starred_url":"https://api.github.com/users/bitpay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitpay/subscriptions","organizations_url":"https://api.github.com/users/bitpay/orgs","repos_url":"https://api.github.com/users/bitpay/repos","events_url":"https://api.github.com/users/bitpay/events{/privacy}","received_events_url":"https://api.github.com/users/bitpay/received_events","type":"Organization","site_admin":false},"repo":{"id":30662924,"name":"bitcore-wallet-service","full_name":"bitpay/bitcore-wallet-service","owner":{"login":"bitpay","id":2554930,"avatar_url":"https://avatars.githubusercontent.com/u/2554930?v=3","gravatar_id":"","url":"https://api.github.com/users/bitpay","html_url":"https://github.com/bitpay","followers_url":"https://api.github.com/users/bitpay/followers","following_url":"https://api.github.com/users/bitpay/following{/other_user}","gists_url":"https://api.github.com/users/bitpay/gists{/gist_id}","starred_url":"https://api.github.com/users/bitpay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitpay/subscriptions","organizations_url":"https://api.github.com/users/bitpay/orgs","repos_url":"https://api.github.com/users/bitpay/repos","events_url":"https://api.github.com/users/bitpay/events{/privacy}","received_events_url":"https://api.github.com/users/bitpay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitpay/bitcore-wallet-service","description":"A multisig, HD wallet service. Used by Copay.","fork":false,"url":"https://api.github.com/repos/bitpay/bitcore-wallet-service","forks_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/forks","keys_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/teams","hooks_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/hooks","issue_events_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/events{/number}","events_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/events","assignees_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/assignees{/user}","branches_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/branches{/branch}","tags_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/tags","blobs_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/statuses/{sha}","languages_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/languages","stargazers_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/stargazers","contributors_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/contributors","subscribers_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/subscribers","subscription_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/subscription","commits_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/contents/{+path}","compare_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/merges","archive_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/downloads","issues_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues{/number}","pulls_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls{/number}","milestones_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/milestones{/number}","notifications_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/labels{/name}","releases_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/releases{/id}","created_at":"2015-02-11T18:33:39Z","updated_at":"2015-08-02T06:03:47Z","pushed_at":"2015-08-03T19:11:29Z","git_url":"git://github.com/bitpay/bitcore-wallet-service.git","ssh_url":"git@github.com:bitpay/bitcore-wallet-service.git","clone_url":"https://github.com/bitpay/bitcore-wallet-service.git","svn_url":"https://github.com/bitpay/bitcore-wallet-service","homepage":"https://copay.io/","size":2912,"stargazers_count":51,"watchers_count":51,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":24,"forks":42,"open_issues":24,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307"},"html":{"href":"https://github.com/bitpay/bitcore-wallet-service/pull/307"},"issue":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/307"},"comments":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/307/comments"},"review_comments":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307/comments"},"review_comment":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/pulls/307/commits"},"statuses":{"href":"https://api.github.com/repos/bitpay/bitcore-wallet-service/statuses/e1fac88a8e7850001f5e4878396deb0da4d40a04"}}}}