{"action":"created","comment":{"url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/comments/70838906","id":70838906,"diff_hunk":"@@ -99,7 +99,15 @@ api.declare({\n       // instead of a more complicated structure\n \n       if (x === 0 && (result.status === 'absent' || result.status === 'error')) {\n-        let validUrl = await validateUrl(url, this.allowedPatterns, this.redirectLimit, this.ensureSSL, this.monitor);\n+        let validUrl;\n+        try {\n+          validUrl = await validateUrl(url, this.allowedPatterns, this.redirectLimit, this.ensureSSL, this.monitor);","path":"src/api-v1.js","position":7,"original_position":7,"commit_id":"dbe9844d6ed0b4a4889a4672e7fcaf93b7291dd8","original_commit_id":"dbe9844d6ed0b4a4889a4672e7fcaf93b7291dd8","user":{"login":"jhford","id":607353,"avatar_url":"https://avatars.githubusercontent.com/u/607353?v=3","gravatar_id":"","url":"https://api.github.com/users/jhford","html_url":"https://github.com/jhford","followers_url":"https://api.github.com/users/jhford/followers","following_url":"https://api.github.com/users/jhford/following{/other_user}","gists_url":"https://api.github.com/users/jhford/gists{/gist_id}","starred_url":"https://api.github.com/users/jhford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhford/subscriptions","organizations_url":"https://api.github.com/users/jhford/orgs","repos_url":"https://api.github.com/users/jhford/repos","events_url":"https://api.github.com/users/jhford/events{/privacy}","received_events_url":"https://api.github.com/users/jhford/received_events","type":"User","site_admin":false},"body":"validate first checks that the URL matches the allowed regexes, then does all the redirects as HEAD requests, validates that all are HTTPS instead of HTTP and then returns.  It only throws when there is an error trying to do a HEAD request.  That's the codepath we're changing here: if we through during a request, we send back the error's status code to set the request's status code.\r\n\r\nThe case where the URL is invalid, but we don't have any http errors is handled by a falsy return value, and handling for that is unchanged by this PR","created_at":"2016-07-14T16:37:46Z","updated_at":"2016-07-14T16:37:46Z","html_url":"https://github.com/taskcluster/cloud-mirror/pull/17#discussion_r70838906","pull_request_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/comments/70838906"},"html":{"href":"https://github.com/taskcluster/cloud-mirror/pull/17#discussion_r70838906"},"pull_request":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17","id":77486036,"html_url":"https://github.com/taskcluster/cloud-mirror/pull/17","diff_url":"https://github.com/taskcluster/cloud-mirror/pull/17.diff","patch_url":"https://github.com/taskcluster/cloud-mirror/pull/17.patch","issue_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/17","number":17,"state":"open","locked":false,"title":"propogate error codes to the requester","user":{"login":"jhford","id":607353,"avatar_url":"https://avatars.githubusercontent.com/u/607353?v=3","gravatar_id":"","url":"https://api.github.com/users/jhford","html_url":"https://github.com/jhford","followers_url":"https://api.github.com/users/jhford/followers","following_url":"https://api.github.com/users/jhford/following{/other_user}","gists_url":"https://api.github.com/users/jhford/gists{/gist_id}","starred_url":"https://api.github.com/users/jhford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhford/subscriptions","organizations_url":"https://api.github.com/users/jhford/orgs","repos_url":"https://api.github.com/users/jhford/repos","events_url":"https://api.github.com/users/jhford/events{/privacy}","received_events_url":"https://api.github.com/users/jhford/received_events","type":"User","site_admin":false},"body":"basically, if we get an error code on the input url we set this as the status code of the request to /redirect","created_at":"2016-07-14T16:31:52Z","updated_at":"2016-07-14T16:37:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5966d53fdf5cf7cd05e8ef82b99164e35ef2b67b","assignee":{"login":"jonasfj","id":149732,"avatar_url":"https://avatars.githubusercontent.com/u/149732?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasfj","html_url":"https://github.com/jonasfj","followers_url":"https://api.github.com/users/jonasfj/followers","following_url":"https://api.github.com/users/jonasfj/following{/other_user}","gists_url":"https://api.github.com/users/jonasfj/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasfj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasfj/subscriptions","organizations_url":"https://api.github.com/users/jonasfj/orgs","repos_url":"https://api.github.com/users/jonasfj/repos","events_url":"https://api.github.com/users/jonasfj/events{/privacy}","received_events_url":"https://api.github.com/users/jonasfj/received_events","type":"User","site_admin":false},"assignees":[{"login":"jonasfj","id":149732,"avatar_url":"https://avatars.githubusercontent.com/u/149732?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasfj","html_url":"https://github.com/jonasfj","followers_url":"https://api.github.com/users/jonasfj/followers","following_url":"https://api.github.com/users/jonasfj/following{/other_user}","gists_url":"https://api.github.com/users/jonasfj/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasfj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasfj/subscriptions","organizations_url":"https://api.github.com/users/jonasfj/orgs","repos_url":"https://api.github.com/users/jonasfj/repos","events_url":"https://api.github.com/users/jonasfj/events{/privacy}","received_events_url":"https://api.github.com/users/jonasfj/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17/commits","review_comments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17/comments","review_comment_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/17/comments","statuses_url":"https://api.github.com/repos/taskcluster/cloud-mirror/statuses/dbe9844d6ed0b4a4889a4672e7fcaf93b7291dd8","head":{"label":"taskcluster:propogate-error-codes","ref":"propogate-error-codes","sha":"dbe9844d6ed0b4a4889a4672e7fcaf93b7291dd8","user":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":47338707,"name":"cloud-mirror","full_name":"taskcluster/cloud-mirror","owner":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/cloud-mirror","description":"cloud mirror","fork":false,"url":"https://api.github.com/repos/taskcluster/cloud-mirror","forks_url":"https://api.github.com/repos/taskcluster/cloud-mirror/forks","keys_url":"https://api.github.com/repos/taskcluster/cloud-mirror/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/cloud-mirror/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/cloud-mirror/teams","hooks_url":"https://api.github.com/repos/taskcluster/cloud-mirror/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/cloud-mirror/events","assignees_url":"https://api.github.com/repos/taskcluster/cloud-mirror/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/cloud-mirror/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/cloud-mirror/tags","blobs_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/cloud-mirror/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/cloud-mirror/languages","stargazers_url":"https://api.github.com/repos/taskcluster/cloud-mirror/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/cloud-mirror/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/cloud-mirror/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/cloud-mirror/subscription","commits_url":"https://api.github.com/repos/taskcluster/cloud-mirror/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/cloud-mirror/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/cloud-mirror/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/cloud-mirror/merges","archive_url":"https://api.github.com/repos/taskcluster/cloud-mirror/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/cloud-mirror/downloads","issues_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/cloud-mirror/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/cloud-mirror/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/cloud-mirror/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/cloud-mirror/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/deployments","created_at":"2015-12-03T14:55:11Z","updated_at":"2016-02-19T14:27:22Z","pushed_at":"2016-07-14T16:31:52Z","git_url":"git://github.com/taskcluster/cloud-mirror.git","ssh_url":"git@github.com:taskcluster/cloud-mirror.git","clone_url":"https://github.com/taskcluster/cloud-mirror.git","svn_url":"https://github.com/taskcluster/cloud-mirror","homepage":"","size":166,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"taskcluster:master","ref":"master","sha":"61ba0e60934c1c747f4bd634f9bc5d616181ac71","user":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":47338707,"name":"cloud-mirror","full_name":"taskcluster/cloud-mirror","owner":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/cloud-mirror","description":"cloud mirror","fork":false,"url":"https://api.github.com/repos/taskcluster/cloud-mirror","forks_url":"https://api.github.com/repos/taskcluster/cloud-mirror/forks","keys_url":"https://api.github.com/repos/taskcluster/cloud-mirror/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/cloud-mirror/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/cloud-mirror/teams","hooks_url":"https://api.github.com/repos/taskcluster/cloud-mirror/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/cloud-mirror/events","assignees_url":"https://api.github.com/repos/taskcluster/cloud-mirror/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/cloud-mirror/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/cloud-mirror/tags","blobs_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/cloud-mirror/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/cloud-mirror/languages","stargazers_url":"https://api.github.com/repos/taskcluster/cloud-mirror/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/cloud-mirror/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/cloud-mirror/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/cloud-mirror/subscription","commits_url":"https://api.github.com/repos/taskcluster/cloud-mirror/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/cloud-mirror/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/cloud-mirror/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/cloud-mirror/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/cloud-mirror/merges","archive_url":"https://api.github.com/repos/taskcluster/cloud-mirror/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/cloud-mirror/downloads","issues_url":"https://api.github.com/repos/taskcluster/cloud-mirror/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/cloud-mirror/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/cloud-mirror/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/cloud-mirror/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/cloud-mirror/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/cloud-mirror/deployments","created_at":"2015-12-03T14:55:11Z","updated_at":"2016-02-19T14:27:22Z","pushed_at":"2016-07-14T16:31:52Z","git_url":"git://github.com/taskcluster/cloud-mirror.git","ssh_url":"git@github.com:taskcluster/cloud-mirror.git","clone_url":"https://github.com/taskcluster/cloud-mirror.git","svn_url":"https://github.com/taskcluster/cloud-mirror","homepage":"","size":166,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17"},"html":{"href":"https://github.com/taskcluster/cloud-mirror/pull/17"},"issue":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/17"},"comments":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/taskcluster/cloud-mirror/statuses/dbe9844d6ed0b4a4889a4672e7fcaf93b7291dd8"}}}}
{"actor":{"display_login":"jhford"}}