{"action":"created","comment":{"url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/comments/77688198","id":77688198,"diff_hunk":"@@ -116,56 +89,48 @@ Consumer.prototype.getRegistrarAddressOnRegistry = function() {\n  */\n Consumer.prototype.getThing = function(identity) {\n   var self = this;\n-  return new Promise(function(fulfill, reject) {\n-    var encodedIdentity = OrUtils.urn.packer.encodeAndChunk(OrUtils.common.compressAll(identity));\n-    self.registry.getThing.call(encodedIdentity, {from: self.address}, function(err, data) {\n-      if (err) {\n-        console.error(err);\n-        reject(err);\n-        return;\n-      }\n-\n-      var encodedIdentities = data[0];\n-      if (encodedIdentities.length == 0) {\n-        reject('Thing is not existing');\n-        return;\n-      }\n+  return Promise.try(function() {\n+    return OrUtils.urn.packer.encodeAndChunk(OrUtils.common.compressAll(identity));\n+  }).then(function(encodedIdentity) {\n+    return self.registry.getThingAsync(encodedIdentity, {from: self.address});\n+  }).then(function(data) {","path":"lib/consumer.js","position":78,"original_position":78,"commit_id":"78ec4ff91d8fcf8ca9ea12f0c67914a240d8e94c","original_commit_id":"78ec4ff91d8fcf8ca9ea12f0c67914a240d8e94c","user":{"login":"orlandoc01","id":14842987,"avatar_url":"https://avatars.githubusercontent.com/u/14842987?v=3","gravatar_id":"","url":"https://api.github.com/users/orlandoc01","html_url":"https://github.com/orlandoc01","followers_url":"https://api.github.com/users/orlandoc01/followers","following_url":"https://api.github.com/users/orlandoc01/following{/other_user}","gists_url":"https://api.github.com/users/orlandoc01/gists{/gist_id}","starred_url":"https://api.github.com/users/orlandoc01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlandoc01/subscriptions","organizations_url":"https://api.github.com/users/orlandoc01/orgs","repos_url":"https://api.github.com/users/orlandoc01/repos","events_url":"https://api.github.com/users/orlandoc01/events{/privacy}","received_events_url":"https://api.github.com/users/orlandoc01/received_events","type":"User","site_admin":false},"body":"Similiar style comment here. If you use arrow functions you can get rid of the `self` declaration at the top. Whether or not these are one line functions is entirely up to you. Something like\r\n```\r\nreturn Promise.try(() => OrUtils.urnpacker.encodeAndCHunc(OrbUtils.common.compressAll(identity)))\r\n.then(id => this.registry.getThingsAsync(id, {from: this.address})\r\n.then(data =>\r\n  ...\r\n```","created_at":"2016-09-06T18:08:24Z","updated_at":"2016-09-06T18:08:24Z","html_url":"https://github.com/chronicled/open-registry-sdk/pull/17#discussion_r77688198","pull_request_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/comments/77688198"},"html":{"href":"https://github.com/chronicled/open-registry-sdk/pull/17#discussion_r77688198"},"pull_request":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17","id":83832248,"html_url":"https://github.com/chronicled/open-registry-sdk/pull/17","diff_url":"https://github.com/chronicled/open-registry-sdk/pull/17.diff","patch_url":"https://github.com/chronicled/open-registry-sdk/pull/17.patch","issue_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/17","number":17,"state":"open","locked":false,"title":"OPENSRC-105 Make sure all the promises will reject in case of internal throw","user":{"login":"lastperson","id":6198746,"avatar_url":"https://avatars.githubusercontent.com/u/6198746?v=3","gravatar_id":"","url":"https://api.github.com/users/lastperson","html_url":"https://github.com/lastperson","followers_url":"https://api.github.com/users/lastperson/followers","following_url":"https://api.github.com/users/lastperson/following{/other_user}","gists_url":"https://api.github.com/users/lastperson/gists{/gist_id}","starred_url":"https://api.github.com/users/lastperson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastperson/subscriptions","organizations_url":"https://api.github.com/users/lastperson/orgs","repos_url":"https://api.github.com/users/lastperson/repos","events_url":"https://api.github.com/users/lastperson/events{/privacy}","received_events_url":"https://api.github.com/users/lastperson/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-02T16:49:33Z","updated_at":"2016-09-06T18:08:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba39862e630cd12b442c831c67a700bdd390f61a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17/commits","review_comments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17/comments","review_comment_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/17/comments","statuses_url":"https://api.github.com/repos/chronicled/open-registry-sdk/statuses/78ec4ff91d8fcf8ca9ea12f0c67914a240d8e94c","head":{"label":"chronicled:opensrc-105-error-reporting","ref":"opensrc-105-error-reporting","sha":"78ec4ff91d8fcf8ca9ea12f0c67914a240d8e94c","user":{"login":"chronicled","id":10505454,"avatar_url":"https://avatars.githubusercontent.com/u/10505454?v=3","gravatar_id":"","url":"https://api.github.com/users/chronicled","html_url":"https://github.com/chronicled","followers_url":"https://api.github.com/users/chronicled/followers","following_url":"https://api.github.com/users/chronicled/following{/other_user}","gists_url":"https://api.github.com/users/chronicled/gists{/gist_id}","starred_url":"https://api.github.com/users/chronicled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronicled/subscriptions","organizations_url":"https://api.github.com/users/chronicled/orgs","repos_url":"https://api.github.com/users/chronicled/repos","events_url":"https://api.github.com/users/chronicled/events{/privacy}","received_events_url":"https://api.github.com/users/chronicled/received_events","type":"Organization","site_admin":false},"repo":{"id":61125943,"name":"open-registry-sdk","full_name":"chronicled/open-registry-sdk","owner":{"login":"chronicled","id":10505454,"avatar_url":"https://avatars.githubusercontent.com/u/10505454?v=3","gravatar_id":"","url":"https://api.github.com/users/chronicled","html_url":"https://github.com/chronicled","followers_url":"https://api.github.com/users/chronicled/followers","following_url":"https://api.github.com/users/chronicled/following{/other_user}","gists_url":"https://api.github.com/users/chronicled/gists{/gist_id}","starred_url":"https://api.github.com/users/chronicled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronicled/subscriptions","organizations_url":"https://api.github.com/users/chronicled/orgs","repos_url":"https://api.github.com/users/chronicled/repos","events_url":"https://api.github.com/users/chronicled/events{/privacy}","received_events_url":"https://api.github.com/users/chronicled/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chronicled/open-registry-sdk","description":"","fork":false,"url":"https://api.github.com/repos/chronicled/open-registry-sdk","forks_url":"https://api.github.com/repos/chronicled/open-registry-sdk/forks","keys_url":"https://api.github.com/repos/chronicled/open-registry-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chronicled/open-registry-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chronicled/open-registry-sdk/teams","hooks_url":"https://api.github.com/repos/chronicled/open-registry-sdk/hooks","issue_events_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/chronicled/open-registry-sdk/events","assignees_url":"https://api.github.com/repos/chronicled/open-registry-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/chronicled/open-registry-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/chronicled/open-registry-sdk/tags","blobs_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chronicled/open-registry-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/chronicled/open-registry-sdk/languages","stargazers_url":"https://api.github.com/repos/chronicled/open-registry-sdk/stargazers","contributors_url":"https://api.github.com/repos/chronicled/open-registry-sdk/contributors","subscribers_url":"https://api.github.com/repos/chronicled/open-registry-sdk/subscribers","subscription_url":"https://api.github.com/repos/chronicled/open-registry-sdk/subscription","commits_url":"https://api.github.com/repos/chronicled/open-registry-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/chronicled/open-registry-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/chronicled/open-registry-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chronicled/open-registry-sdk/merges","archive_url":"https://api.github.com/repos/chronicled/open-registry-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chronicled/open-registry-sdk/downloads","issues_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/chronicled/open-registry-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/chronicled/open-registry-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chronicled/open-registry-sdk/labels{/name}","releases_url":"https://api.github.com/repos/chronicled/open-registry-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/deployments","created_at":"2016-06-14T13:41:11Z","updated_at":"2016-08-20T13:35:01Z","pushed_at":"2016-09-06T17:12:25Z","git_url":"git://github.com/chronicled/open-registry-sdk.git","ssh_url":"git@github.com:chronicled/open-registry-sdk.git","clone_url":"https://github.com/chronicled/open-registry-sdk.git","svn_url":"https://github.com/chronicled/open-registry-sdk","homepage":null,"size":22422,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"chronicled:master","ref":"master","sha":"3805643a8931c43ebddae14b4dda3cd96aa53e49","user":{"login":"chronicled","id":10505454,"avatar_url":"https://avatars.githubusercontent.com/u/10505454?v=3","gravatar_id":"","url":"https://api.github.com/users/chronicled","html_url":"https://github.com/chronicled","followers_url":"https://api.github.com/users/chronicled/followers","following_url":"https://api.github.com/users/chronicled/following{/other_user}","gists_url":"https://api.github.com/users/chronicled/gists{/gist_id}","starred_url":"https://api.github.com/users/chronicled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronicled/subscriptions","organizations_url":"https://api.github.com/users/chronicled/orgs","repos_url":"https://api.github.com/users/chronicled/repos","events_url":"https://api.github.com/users/chronicled/events{/privacy}","received_events_url":"https://api.github.com/users/chronicled/received_events","type":"Organization","site_admin":false},"repo":{"id":61125943,"name":"open-registry-sdk","full_name":"chronicled/open-registry-sdk","owner":{"login":"chronicled","id":10505454,"avatar_url":"https://avatars.githubusercontent.com/u/10505454?v=3","gravatar_id":"","url":"https://api.github.com/users/chronicled","html_url":"https://github.com/chronicled","followers_url":"https://api.github.com/users/chronicled/followers","following_url":"https://api.github.com/users/chronicled/following{/other_user}","gists_url":"https://api.github.com/users/chronicled/gists{/gist_id}","starred_url":"https://api.github.com/users/chronicled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronicled/subscriptions","organizations_url":"https://api.github.com/users/chronicled/orgs","repos_url":"https://api.github.com/users/chronicled/repos","events_url":"https://api.github.com/users/chronicled/events{/privacy}","received_events_url":"https://api.github.com/users/chronicled/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chronicled/open-registry-sdk","description":"","fork":false,"url":"https://api.github.com/repos/chronicled/open-registry-sdk","forks_url":"https://api.github.com/repos/chronicled/open-registry-sdk/forks","keys_url":"https://api.github.com/repos/chronicled/open-registry-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chronicled/open-registry-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chronicled/open-registry-sdk/teams","hooks_url":"https://api.github.com/repos/chronicled/open-registry-sdk/hooks","issue_events_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/chronicled/open-registry-sdk/events","assignees_url":"https://api.github.com/repos/chronicled/open-registry-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/chronicled/open-registry-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/chronicled/open-registry-sdk/tags","blobs_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chronicled/open-registry-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/chronicled/open-registry-sdk/languages","stargazers_url":"https://api.github.com/repos/chronicled/open-registry-sdk/stargazers","contributors_url":"https://api.github.com/repos/chronicled/open-registry-sdk/contributors","subscribers_url":"https://api.github.com/repos/chronicled/open-registry-sdk/subscribers","subscription_url":"https://api.github.com/repos/chronicled/open-registry-sdk/subscription","commits_url":"https://api.github.com/repos/chronicled/open-registry-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/chronicled/open-registry-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/chronicled/open-registry-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/chronicled/open-registry-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chronicled/open-registry-sdk/merges","archive_url":"https://api.github.com/repos/chronicled/open-registry-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chronicled/open-registry-sdk/downloads","issues_url":"https://api.github.com/repos/chronicled/open-registry-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/chronicled/open-registry-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/chronicled/open-registry-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chronicled/open-registry-sdk/labels{/name}","releases_url":"https://api.github.com/repos/chronicled/open-registry-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/chronicled/open-registry-sdk/deployments","created_at":"2016-06-14T13:41:11Z","updated_at":"2016-08-20T13:35:01Z","pushed_at":"2016-09-06T17:12:25Z","git_url":"git://github.com/chronicled/open-registry-sdk.git","ssh_url":"git@github.com:chronicled/open-registry-sdk.git","clone_url":"https://github.com/chronicled/open-registry-sdk.git","svn_url":"https://github.com/chronicled/open-registry-sdk","homepage":null,"size":22422,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17"},"html":{"href":"https://github.com/chronicled/open-registry-sdk/pull/17"},"issue":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/17"},"comments":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/chronicled/open-registry-sdk/statuses/78ec4ff91d8fcf8ca9ea12f0c67914a240d8e94c"}}}}
{"actor":{"display_login":"orlandoc01"}}