{"action":"created","comment":{"url":"https://api.github.com/repos/mysociety/pombola/pulls/comments/174419403","pull_request_review_id":103769133,"id":174419403,"diff_hunk":"@@ -89,7 +89,10 @@ def get_messages(self, person_popolo_uri):\n             'api_key': self.api_key,\n             'person__popolo_uri': person_popolo_uri,\n         }\n-        response = requests.get(url, params=params)\n-        response.raise_for_status()\n-        messages = response.json()['objects']\n-        return [Message(m, adapter=self.adapter) for m in messages]\n+        try:\n+            response = requests.get(url, params=params)\n+            response.raise_for_status()\n+            messages = response.json()['objects']\n+            return [Message(m, adapter=self.adapter) for m in messages]\n+        except requests.exceptions.RequestException as err:","path":"pombola/writeinpublic/client.py","position":13,"original_position":13,"commit_id":"b52a6d1bb8dc4e7712bc5c0bc93e7c10d7b87aa6","original_commit_id":"d30ec09b5ea9d41b817618874cb1b34476308a97","user":{"login":"mhl","id":7907,"avatar_url":"https://avatars3.githubusercontent.com/u/7907?v=4","gravatar_id":"","url":"https://api.github.com/users/mhl","html_url":"https://github.com/mhl","followers_url":"https://api.github.com/users/mhl/followers","following_url":"https://api.github.com/users/mhl/following{/other_user}","gists_url":"https://api.github.com/users/mhl/gists{/gist_id}","starred_url":"https://api.github.com/users/mhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhl/subscriptions","organizations_url":"https://api.github.com/users/mhl/orgs","repos_url":"https://api.github.com/users/mhl/repos","events_url":"https://api.github.com/users/mhl/events{/privacy}","received_events_url":"https://api.github.com/users/mhl/received_events","type":"User","site_admin":false},"body":"It worries me a bit that this is catching any error that might arise from the request, including things we might want to know about like 5xx errors. I think I'd be tempted to do something like:\r\n```\r\ntry:\r\n    response = requests.get(url, params=params)\r\n    if response.status == 404:\r\n        return []\r\n    response.raise_for_status()\r\n    messages = response.json()['objects']\r\n    return [Message(m, adapter=self.adapter) for m in messages]\r\n```\r\n\r\nThen the calling code in `pombola/writeinpublic/views.py` wouldn't need to be changed as part of this PR...\r\n","created_at":"2018-03-14T10:52:39Z","updated_at":"2018-03-14T10:53:30Z","html_url":"https://github.com/mysociety/pombola/pull/2400#discussion_r174419403","pull_request_url":"https://api.github.com/repos/mysociety/pombola/pulls/2400","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/comments/174419403"},"html":{"href":"https://github.com/mysociety/pombola/pull/2400#discussion_r174419403"},"pull_request":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/2400"}}},"pull_request":{"url":"https://api.github.com/repos/mysociety/pombola/pulls/2400","id":174736982,"html_url":"https://github.com/mysociety/pombola/pull/2400","diff_url":"https://github.com/mysociety/pombola/pull/2400.diff","patch_url":"https://github.com/mysociety/pombola/pull/2400.patch","issue_url":"https://api.github.com/repos/mysociety/pombola/issues/2400","number":2400,"state":"open","locked":false,"title":"[WriteInPublic] Handle errors when retrieving messages","user":{"login":"chrismytton","id":22996,"avatar_url":"https://avatars2.githubusercontent.com/u/22996?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismytton","html_url":"https://github.com/chrismytton","followers_url":"https://api.github.com/users/chrismytton/followers","following_url":"https://api.github.com/users/chrismytton/following{/other_user}","gists_url":"https://api.github.com/users/chrismytton/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismytton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismytton/subscriptions","organizations_url":"https://api.github.com/users/chrismytton/orgs","repos_url":"https://api.github.com/users/chrismytton/repos","events_url":"https://api.github.com/users/chrismytton/events{/privacy}","received_events_url":"https://api.github.com/users/chrismytton/received_events","type":"User","site_admin":false},"body":"If the committee that we're requesting message for doesn't exist in the WiP instance then it will return a 404. We want to ignore this error and just use an empty list of messages in the context in that case.\r\n\r\nPart of #2399","created_at":"2018-03-13T17:37:54Z","updated_at":"2018-03-14T10:53:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"adc72570633c16db4665d10c9003bd1e82a051b4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mysociety/pombola/pulls/2400/commits","review_comments_url":"https://api.github.com/repos/mysociety/pombola/pulls/2400/comments","review_comment_url":"https://api.github.com/repos/mysociety/pombola/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mysociety/pombola/issues/2400/comments","statuses_url":"https://api.github.com/repos/mysociety/pombola/statuses/b52a6d1bb8dc4e7712bc5c0bc93e7c10d7b87aa6","head":{"label":"mysociety:2399-fix-500-on-non-contactable-committees","ref":"2399-fix-500-on-non-contactable-committees","sha":"b52a6d1bb8dc4e7712bc5c0bc93e7c10d7b87aa6","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars1.githubusercontent.com/u/141338?v=4","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":1994469,"name":"pombola","full_name":"mysociety/pombola","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars1.githubusercontent.com/u/141338?v=4","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/pombola","description":"Pombola is a parliamentary monitoring (PMO) platform; its biggest instances are Mzalendo.com and pa.org.za","fork":false,"url":"https://api.github.com/repos/mysociety/pombola","forks_url":"https://api.github.com/repos/mysociety/pombola/forks","keys_url":"https://api.github.com/repos/mysociety/pombola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/pombola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/pombola/teams","hooks_url":"https://api.github.com/repos/mysociety/pombola/hooks","issue_events_url":"https://api.github.com/repos/mysociety/pombola/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/pombola/events","assignees_url":"https://api.github.com/repos/mysociety/pombola/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/pombola/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/pombola/tags","blobs_url":"https://api.github.com/repos/mysociety/pombola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/pombola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/pombola/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/pombola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/pombola/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/pombola/languages","stargazers_url":"https://api.github.com/repos/mysociety/pombola/stargazers","contributors_url":"https://api.github.com/repos/mysociety/pombola/contributors","subscribers_url":"https://api.github.com/repos/mysociety/pombola/subscribers","subscription_url":"https://api.github.com/repos/mysociety/pombola/subscription","commits_url":"https://api.github.com/repos/mysociety/pombola/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/pombola/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/pombola/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/pombola/issues/comments{/number}","contents_url":"https://api.github.com/repos/mysociety/pombola/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/pombola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/pombola/merges","archive_url":"https://api.github.com/repos/mysociety/pombola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/pombola/downloads","issues_url":"https://api.github.com/repos/mysociety/pombola/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/pombola/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/pombola/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/pombola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/pombola/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/pombola/releases{/id}","deployments_url":"https://api.github.com/repos/mysociety/pombola/deployments","created_at":"2011-07-04T08:46:51Z","updated_at":"2018-03-12T16:07:19Z","pushed_at":"2018-03-14T10:45:47Z","git_url":"git://github.com/mysociety/pombola.git","ssh_url":"git@github.com:mysociety/pombola.git","clone_url":"https://github.com/mysociety/pombola.git","svn_url":"https://github.com/mysociety/pombola","homepage":"http://www.mysociety.org/projects/parliamentarymonitoring/pombola/","size":32238,"stargazers_count":56,"watchers_count":56,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"archived":false,"open_issues_count":206,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":44,"open_issues":206,"watchers":56,"default_branch":"master"}},"base":{"label":"mysociety:master","ref":"master","sha":"e2e8b29be2c64ca9010be08c34337788871f31a5","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars1.githubusercontent.com/u/141338?v=4","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":1994469,"name":"pombola","full_name":"mysociety/pombola","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars1.githubusercontent.com/u/141338?v=4","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/pombola","description":"Pombola is a parliamentary monitoring (PMO) platform; its biggest instances are Mzalendo.com and pa.org.za","fork":false,"url":"https://api.github.com/repos/mysociety/pombola","forks_url":"https://api.github.com/repos/mysociety/pombola/forks","keys_url":"https://api.github.com/repos/mysociety/pombola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/pombola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/pombola/teams","hooks_url":"https://api.github.com/repos/mysociety/pombola/hooks","issue_events_url":"https://api.github.com/repos/mysociety/pombola/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/pombola/events","assignees_url":"https://api.github.com/repos/mysociety/pombola/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/pombola/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/pombola/tags","blobs_url":"https://api.github.com/repos/mysociety/pombola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/pombola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/pombola/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/pombola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/pombola/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/pombola/languages","stargazers_url":"https://api.github.com/repos/mysociety/pombola/stargazers","contributors_url":"https://api.github.com/repos/mysociety/pombola/contributors","subscribers_url":"https://api.github.com/repos/mysociety/pombola/subscribers","subscription_url":"https://api.github.com/repos/mysociety/pombola/subscription","commits_url":"https://api.github.com/repos/mysociety/pombola/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/pombola/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/pombola/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/pombola/issues/comments{/number}","contents_url":"https://api.github.com/repos/mysociety/pombola/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/pombola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/pombola/merges","archive_url":"https://api.github.com/repos/mysociety/pombola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/pombola/downloads","issues_url":"https://api.github.com/repos/mysociety/pombola/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/pombola/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/pombola/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/pombola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/pombola/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/pombola/releases{/id}","deployments_url":"https://api.github.com/repos/mysociety/pombola/deployments","created_at":"2011-07-04T08:46:51Z","updated_at":"2018-03-12T16:07:19Z","pushed_at":"2018-03-14T10:45:47Z","git_url":"git://github.com/mysociety/pombola.git","ssh_url":"git@github.com:mysociety/pombola.git","clone_url":"https://github.com/mysociety/pombola.git","svn_url":"https://github.com/mysociety/pombola","homepage":"http://www.mysociety.org/projects/parliamentarymonitoring/pombola/","size":32238,"stargazers_count":56,"watchers_count":56,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"archived":false,"open_issues_count":206,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":44,"open_issues":206,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/2400"},"html":{"href":"https://github.com/mysociety/pombola/pull/2400"},"issue":{"href":"https://api.github.com/repos/mysociety/pombola/issues/2400"},"comments":{"href":"https://api.github.com/repos/mysociety/pombola/issues/2400/comments"},"review_comments":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/2400/comments"},"review_comment":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mysociety/pombola/pulls/2400/commits"},"statuses":{"href":"https://api.github.com/repos/mysociety/pombola/statuses/b52a6d1bb8dc4e7712bc5c0bc93e7c10d7b87aa6"}},"author_association":"OWNER"}}
{"actor":{"display_login":"mhl"}}