{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/80766350","pull_request_review_id":1798904,"id":80766350,"diff_hunk":"@@ -11,16 +14,20 @@ export default (router, apiOptions) => {\n                                              newsletterSubscribe, gRecaptchaResponse);\n       // writeSessionToResponse will set the cookies\n       writeSessionToResponse(ctx, data);\n-    } catch (e) {\n-      console.log(e);\n-      let errormsg = 'UNKNOWN_ERROR';\n-\n-      if (e && (typeof e === 'string')) {\n-        errormsg = e;\n+    } catch (error) {\n+      ctx.status = 401;\n+      if (error && (typeof error === 'string')) {\n+        ctx.type = 'application/json';","path":"src/server/session/registerproxy.js","position":23,"original_position":23,"commit_id":"9a4f85ae15acc63da6a6baf1a584fcbc9ce379b4","original_commit_id":"9a4f85ae15acc63da6a6baf1a584fcbc9ce379b4","user":{"login":"schwers","id":307983,"avatar_url":"https://avatars.githubusercontent.com/u/307983?v=3","gravatar_id":"","url":"https://api.github.com/users/schwers","html_url":"https://github.com/schwers","followers_url":"https://api.github.com/users/schwers/followers","following_url":"https://api.github.com/users/schwers/following{/other_user}","gists_url":"https://api.github.com/users/schwers/gists{/gist_id}","starred_url":"https://api.github.com/users/schwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schwers/subscriptions","organizations_url":"https://api.github.com/users/schwers/orgs","repos_url":"https://api.github.com/users/schwers/repos","events_url":"https://api.github.com/users/schwers/events{/privacy}","received_events_url":"https://api.github.com/users/schwers/received_events","type":"User","site_admin":false},"body":"🔕  I think Koa will do this for you automatically if you set body to a dictionary like you're doing in the line below.","created_at":"2016-09-27T18:46:45Z","updated_at":"2016-09-27T18:46:45Z","html_url":"https://github.com/reddit/reddit-mobile/pull/772#discussion_r80766350","pull_request_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/80766350"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/772#discussion_r80766350"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772","id":86890162,"html_url":"https://github.com/reddit/reddit-mobile/pull/772","diff_url":"https://github.com/reddit/reddit-mobile/pull/772.diff","patch_url":"https://github.com/reddit/reddit-mobile/pull/772.patch","issue_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/772","number":772,"state":"open","locked":false,"title":"Fix error handling for Register","user":{"login":"jamesmaa","id":2382537,"avatar_url":"https://avatars.githubusercontent.com/u/2382537?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmaa","html_url":"https://github.com/jamesmaa","followers_url":"https://api.github.com/users/jamesmaa/followers","following_url":"https://api.github.com/users/jamesmaa/following{/other_user}","gists_url":"https://api.github.com/users/jamesmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmaa/subscriptions","organizations_url":"https://api.github.com/users/jamesmaa/orgs","repos_url":"https://api.github.com/users/jamesmaa/repos","events_url":"https://api.github.com/users/jamesmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmaa/received_events","type":"User","site_admin":false},"body":"I looked into the koa docs and found some examples I was modeling off of. It seems to produce simpler and more readable code and it works.\r\n\r\nhttps://github.com/koajs/koa#koa-v2\r\nhttp://stackoverflow.com/questions/22059775/using-callbacks-with-nodejs-in-koa\r\n\r\nThe problem with the Login error handling fix is that ultimately it is convoluted to differentiate between different types of errors, and requires additional JSON parsing.\r\n\r\nHappy to discuss whether this is the right approach or not\r\n\r\n👓 @phil303 ","created_at":"2016-09-27T09:13:34Z","updated_at":"2016-09-27T18:46:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c143ccdac992dab5e663295c305636f0b1898cfd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772/comments","review_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/772/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/9a4f85ae15acc63da6a6baf1a584fcbc9ce379b4","head":{"label":"jamesmaa:regproxy-fix","ref":"regproxy-fix","sha":"9a4f85ae15acc63da6a6baf1a584fcbc9ce379b4","user":{"login":"jamesmaa","id":2382537,"avatar_url":"https://avatars.githubusercontent.com/u/2382537?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmaa","html_url":"https://github.com/jamesmaa","followers_url":"https://api.github.com/users/jamesmaa/followers","following_url":"https://api.github.com/users/jamesmaa/following{/other_user}","gists_url":"https://api.github.com/users/jamesmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmaa/subscriptions","organizations_url":"https://api.github.com/users/jamesmaa/orgs","repos_url":"https://api.github.com/users/jamesmaa/repos","events_url":"https://api.github.com/users/jamesmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmaa/received_events","type":"User","site_admin":false},"repo":{"id":58663030,"name":"reddit-mobile","full_name":"jamesmaa/reddit-mobile","owner":{"login":"jamesmaa","id":2382537,"avatar_url":"https://avatars.githubusercontent.com/u/2382537?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmaa","html_url":"https://github.com/jamesmaa","followers_url":"https://api.github.com/users/jamesmaa/followers","following_url":"https://api.github.com/users/jamesmaa/following{/other_user}","gists_url":"https://api.github.com/users/jamesmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmaa/subscriptions","organizations_url":"https://api.github.com/users/jamesmaa/orgs","repos_url":"https://api.github.com/users/jamesmaa/repos","events_url":"https://api.github.com/users/jamesmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmaa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamesmaa/reddit-mobile","description":"","fork":true,"url":"https://api.github.com/repos/jamesmaa/reddit-mobile","forks_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/forks","keys_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/events","assignees_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/merges","archive_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/jamesmaa/reddit-mobile/deployments","created_at":"2016-05-12T17:35:30Z","updated_at":"2016-05-12T17:35:33Z","pushed_at":"2016-09-27T17:53:33Z","git_url":"git://github.com/jamesmaa/reddit-mobile.git","ssh_url":"git@github.com:jamesmaa/reddit-mobile.git","clone_url":"https://github.com/jamesmaa/reddit-mobile.git","svn_url":"https://github.com/jamesmaa/reddit-mobile","homepage":null,"size":6861,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reddit:2X","ref":"2X","sha":"45c0e1f082c34270a189c8a9f2287d50f5e1805c","user":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":23087554,"name":"reddit-mobile","full_name":"reddit/reddit-mobile","owner":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reddit/reddit-mobile","description":"","fork":false,"url":"https://api.github.com/repos/reddit/reddit-mobile","forks_url":"https://api.github.com/repos/reddit/reddit-mobile/forks","keys_url":"https://api.github.com/repos/reddit/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/reddit/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/reddit-mobile/events","assignees_url":"https://api.github.com/repos/reddit/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/reddit/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/reddit/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/reddit/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/reddit/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/reddit/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/reddit-mobile/merges","archive_url":"https://api.github.com/repos/reddit/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/reddit/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/reddit/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/reddit/reddit-mobile/deployments","created_at":"2014-08-18T21:42:05Z","updated_at":"2016-09-27T13:27:08Z","pushed_at":"2016-09-27T18:46:38Z","git_url":"git://github.com/reddit/reddit-mobile.git","ssh_url":"git@github.com:reddit/reddit-mobile.git","clone_url":"https://github.com/reddit/reddit-mobile.git","svn_url":"https://github.com/reddit/reddit-mobile","homepage":null,"size":10543,"stargazers_count":852,"watchers_count":852,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":144,"mirror_url":null,"open_issues_count":26,"forks":144,"open_issues":26,"watchers":852,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/772"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/772"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/772/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/772/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-mobile/statuses/9a4f85ae15acc63da6a6baf1a584fcbc9ce379b4"}}}}
{"actor":{"display_login":"schwers"}}