{"action":"created","comment":{"url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/comments/86172714","pull_request_review_id":6843037,"id":86172714,"diff_hunk":"@@ -0,0 +1,168 @@\n+\"use strict\";\n+\n+module.exports = (error, logger, parseLinkHeader) => {\n+    /**\n+     * @typedef {Object} artifactResponse\n+     * @property {string} statusCode The HTTP status code.\n+     * @property {string} message The status message for the response.\n+     * @property {Object} body The response body.\n+     * @property {string} location The url of the uploaded artifact.\n+     */\n+\n+    /**\n+     * Handles the response gotten from making requests to Shelf.\n+     *\n+     * @param {http~IncomingMessage} response\n+     * @return {Promise.<Object>}\n+     */\n+    function handleArtifactResponse(response) {\n+        var artifactResponse;\n+\n+        logger.debug(\"In handleArtifactResponse()\");\n+\n+        if (!response.body) {\n+            response.body = {};\n+        }\n+\n+        artifactResponse = {};\n+        logger.debug(`Response: ${JSON.stringify(response, null, 4)}`);\n+        logger.debug(`Status code: ${response.statusCode}`);\n+        logger.debug(`Response body: ${JSON.stringify(response.body, null, 4)}`);\n+        artifactResponse.statusCode = response.statusCode;\n+\n+        if (artifactResponse.statusCode === 201) {\n+            artifactResponse.message = \"Artifact upload successful.\";\n+            artifactResponse.location = response.headers.location;\n+        } else if (artifactResponse.statusCode === 200) {\n+            artifactResponse.message = \"Artifact download successful.\";\n+            artifactResponse.body = response.body;\n+        } else {\n+            if (response.body.code) {\n+                // Try to grab the error code we received.\n+                artifactResponse = Object.keys(error).filter((key) => {\n+                    return key.code === response.body.code;\n+                });\n+\n+                if (artifactResponse) {\n+                    throw new Error(artifactResponse.message, artifactResponse.code);\n+                } else {\n+                    throw new Error(error.UNKNOWN.message, error.UNKNOWN.code);\n+                }\n+            } else if (response.body === error.UNAUTHORIZED.message) {\n+                throw new Error(error.UNAUTHORIZED.message, error.UNAUTHORIZED.code);\n+            }\n+\n+            throw new Error(error.UNKNOWN.message, error.UNKNOWN.code);\n+        }\n+\n+        return Promise.resolve(artifactResponse);","path":"lib/response-handler.js","position":null,"original_position":58,"commit_id":"2dee7d57946de7b441fa913e06b7a1b0890e67ab","original_commit_id":"c1f774de9770b28e80f5fbcce6def70533b4dd93","user":{"login":"kyle-long","id":1569367,"avatar_url":"https://avatars.githubusercontent.com/u/1569367?v=3","gravatar_id":"","url":"https://api.github.com/users/kyle-long","html_url":"https://github.com/kyle-long","followers_url":"https://api.github.com/users/kyle-long/followers","following_url":"https://api.github.com/users/kyle-long/following{/other_user}","gists_url":"https://api.github.com/users/kyle-long/gists{/gist_id}","starred_url":"https://api.github.com/users/kyle-long/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyle-long/subscriptions","organizations_url":"https://api.github.com/users/kyle-long/orgs","repos_url":"https://api.github.com/users/kyle-long/repos","events_url":"https://api.github.com/users/kyle-long/events{/privacy}","received_events_url":"https://api.github.com/users/kyle-long/received_events","type":"User","site_admin":false},"body":"```\r\nbluebird.try(() => {\r\n    return \"hello\";\r\n}).then((helloVal) => {\r\n    console.log(helloVal);\r\n});\r\n```","created_at":"2016-11-02T15:43:26Z","updated_at":"2016-11-02T15:43:26Z","html_url":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1#discussion_r86172714","pull_request_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/comments/86172714"},"html":{"href":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1#discussion_r86172714"},"pull_request":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1","id":90040543,"html_url":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1","diff_url":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1.diff","patch_url":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1.patch","issue_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/1","number":1,"state":"open","locked":false,"title":"First fully working version of shelf-lib-js","user":{"login":"GoogilyBoogily","id":1896759,"avatar_url":"https://avatars.githubusercontent.com/u/1896759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogilyBoogily","html_url":"https://github.com/GoogilyBoogily","followers_url":"https://api.github.com/users/GoogilyBoogily/followers","following_url":"https://api.github.com/users/GoogilyBoogily/following{/other_user}","gists_url":"https://api.github.com/users/GoogilyBoogily/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogilyBoogily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogilyBoogily/subscriptions","organizations_url":"https://api.github.com/users/GoogilyBoogily/orgs","repos_url":"https://api.github.com/users/GoogilyBoogily/repos","events_url":"https://api.github.com/users/GoogilyBoogily/events{/privacy}","received_events_url":"https://api.github.com/users/GoogilyBoogily/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-19T16:03:06Z","updated_at":"2016-11-02T15:43:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8797218d8709cc1dd8526c09451c76936c37707b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1/commits","review_comments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1/comments","review_comment_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/1/comments","statuses_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/statuses/2dee7d57946de7b441fa913e06b7a1b0890e67ab","head":{"label":"GoogilyBoogily:develop","ref":"develop","sha":"2dee7d57946de7b441fa913e06b7a1b0890e67ab","user":{"login":"GoogilyBoogily","id":1896759,"avatar_url":"https://avatars.githubusercontent.com/u/1896759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogilyBoogily","html_url":"https://github.com/GoogilyBoogily","followers_url":"https://api.github.com/users/GoogilyBoogily/followers","following_url":"https://api.github.com/users/GoogilyBoogily/following{/other_user}","gists_url":"https://api.github.com/users/GoogilyBoogily/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogilyBoogily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogilyBoogily/subscriptions","organizations_url":"https://api.github.com/users/GoogilyBoogily/orgs","repos_url":"https://api.github.com/users/GoogilyBoogily/repos","events_url":"https://api.github.com/users/GoogilyBoogily/events{/privacy}","received_events_url":"https://api.github.com/users/GoogilyBoogily/received_events","type":"User","site_admin":false},"repo":{"id":70175423,"name":"shelf-lib-js","full_name":"GoogilyBoogily/shelf-lib-js","owner":{"login":"GoogilyBoogily","id":1896759,"avatar_url":"https://avatars.githubusercontent.com/u/1896759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogilyBoogily","html_url":"https://github.com/GoogilyBoogily","followers_url":"https://api.github.com/users/GoogilyBoogily/followers","following_url":"https://api.github.com/users/GoogilyBoogily/following{/other_user}","gists_url":"https://api.github.com/users/GoogilyBoogily/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogilyBoogily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogilyBoogily/subscriptions","organizations_url":"https://api.github.com/users/GoogilyBoogily/orgs","repos_url":"https://api.github.com/users/GoogilyBoogily/repos","events_url":"https://api.github.com/users/GoogilyBoogily/events{/privacy}","received_events_url":"https://api.github.com/users/GoogilyBoogily/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GoogilyBoogily/shelf-lib-js","description":null,"fork":false,"url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js","forks_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/forks","keys_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/teams","hooks_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/hooks","issue_events_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/events{/number}","events_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/events","assignees_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/assignees{/user}","branches_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/branches{/branch}","tags_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/tags","blobs_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/languages","stargazers_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/stargazers","contributors_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/contributors","subscribers_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/subscribers","subscription_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/subscription","commits_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/contents/{+path}","compare_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/merges","archive_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/downloads","issues_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues{/number}","pulls_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/labels{/name}","releases_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/releases{/id}","deployments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/deployments","created_at":"2016-10-06T17:13:01Z","updated_at":"2016-10-13T13:20:09Z","pushed_at":"2016-11-01T21:40:24Z","git_url":"git://github.com/GoogilyBoogily/shelf-lib-js.git","ssh_url":"git@github.com:GoogilyBoogily/shelf-lib-js.git","clone_url":"https://github.com/GoogilyBoogily/shelf-lib-js.git","svn_url":"https://github.com/GoogilyBoogily/shelf-lib-js","homepage":null,"size":45,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogilyBoogily:master","ref":"master","sha":"cdc91200127a05fbbbc3e5738159a9dd0c7d10db","user":{"login":"GoogilyBoogily","id":1896759,"avatar_url":"https://avatars.githubusercontent.com/u/1896759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogilyBoogily","html_url":"https://github.com/GoogilyBoogily","followers_url":"https://api.github.com/users/GoogilyBoogily/followers","following_url":"https://api.github.com/users/GoogilyBoogily/following{/other_user}","gists_url":"https://api.github.com/users/GoogilyBoogily/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogilyBoogily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogilyBoogily/subscriptions","organizations_url":"https://api.github.com/users/GoogilyBoogily/orgs","repos_url":"https://api.github.com/users/GoogilyBoogily/repos","events_url":"https://api.github.com/users/GoogilyBoogily/events{/privacy}","received_events_url":"https://api.github.com/users/GoogilyBoogily/received_events","type":"User","site_admin":false},"repo":{"id":70175423,"name":"shelf-lib-js","full_name":"GoogilyBoogily/shelf-lib-js","owner":{"login":"GoogilyBoogily","id":1896759,"avatar_url":"https://avatars.githubusercontent.com/u/1896759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogilyBoogily","html_url":"https://github.com/GoogilyBoogily","followers_url":"https://api.github.com/users/GoogilyBoogily/followers","following_url":"https://api.github.com/users/GoogilyBoogily/following{/other_user}","gists_url":"https://api.github.com/users/GoogilyBoogily/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogilyBoogily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogilyBoogily/subscriptions","organizations_url":"https://api.github.com/users/GoogilyBoogily/orgs","repos_url":"https://api.github.com/users/GoogilyBoogily/repos","events_url":"https://api.github.com/users/GoogilyBoogily/events{/privacy}","received_events_url":"https://api.github.com/users/GoogilyBoogily/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GoogilyBoogily/shelf-lib-js","description":null,"fork":false,"url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js","forks_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/forks","keys_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/teams","hooks_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/hooks","issue_events_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/events{/number}","events_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/events","assignees_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/assignees{/user}","branches_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/branches{/branch}","tags_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/tags","blobs_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/languages","stargazers_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/stargazers","contributors_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/contributors","subscribers_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/subscribers","subscription_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/subscription","commits_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/contents/{+path}","compare_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/merges","archive_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/downloads","issues_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues{/number}","pulls_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/labels{/name}","releases_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/releases{/id}","deployments_url":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/deployments","created_at":"2016-10-06T17:13:01Z","updated_at":"2016-10-13T13:20:09Z","pushed_at":"2016-11-01T21:40:24Z","git_url":"git://github.com/GoogilyBoogily/shelf-lib-js.git","ssh_url":"git@github.com:GoogilyBoogily/shelf-lib-js.git","clone_url":"https://github.com/GoogilyBoogily/shelf-lib-js.git","svn_url":"https://github.com/GoogilyBoogily/shelf-lib-js","homepage":null,"size":45,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1"},"html":{"href":"https://github.com/GoogilyBoogily/shelf-lib-js/pull/1"},"issue":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/1"},"comments":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/GoogilyBoogily/shelf-lib-js/statuses/2dee7d57946de7b441fa913e06b7a1b0890e67ab"}}}}
{"actor":{"display_login":"kyle-long"}}