{"action":"created","comment":{"url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/comments/92801662","pull_request_review_id":13322970,"id":92801662,"diff_hunk":"@@ -0,0 +1,111 @@\n+// Part of measurement-kit <https://measurement-kit.github.io/>.\n+// Measurement-kit is free software. See AUTHORS and LICENSE for more\n+// information on the copying conditions.\n+\n+#include \"bouncer_impl.hpp\"\n+\n+namespace mk {\n+namespace ooni {\n+namespace bouncer {\n+\n+\n+ErrorOr<Var<BouncerReply>> BouncerReply::create(std::string data, Var<Logger> logger) {\n+    Var<BouncerReply> reply(new BouncerReply);\n+    try {\n+        reply->response = json::parse(data);\n+        if (reply->response.find(\"error\") != reply->response.end()) {\n+            if (reply->response[\"error\"] == \"collector-not-found\") {\n+                logger->warn(\n+                        \"collector not found for the requested test\");\n+                return BouncerCollectorNotFoundError();\n+            }\n+            if (reply->response[\"error\"] == \"invalid-request\") {\n+                logger->warn(\"invalid request sent to the bouncer\");\n+                return BouncerInvalidRequestError();\n+            }\n+            // I assume that if we receive a json with the key \"error\"\n+            // then the json has an unknown schema and we should not\n+            // continue to process it\n+            logger->warn(\"bouncer generic error\");\n+            return BouncerGenericError();\n+        }\n+        if (reply->response[\"net-tests\"].empty()) {\n+            logger->warn(\"generic bouncer error\");\n+            return BouncerTestHelperNotFoundError();\n+        }\n+    } catch (std::invalid_argument &) {\n+        return JsonParseError();\n+    } catch (std::out_of_range &) {\n+        return JsonKeyError();\n+    } catch (std::domain_error &) {\n+        return JsonDomainError();\n+    }","path":"src/libmeasurement_kit/ooni/bouncer_impl.cpp","position":42,"original_position":42,"commit_id":"f4c67f1e7639128ce8d2300f3102d6316621ecb3","original_commit_id":"98cc147ea8d30bb32d968004e87f12f00750168d","user":{"login":"bassosimone","id":337298,"avatar_url":"https://avatars.githubusercontent.com/u/337298?v=3","gravatar_id":"","url":"https://api.github.com/users/bassosimone","html_url":"https://github.com/bassosimone","followers_url":"https://api.github.com/users/bassosimone/followers","following_url":"https://api.github.com/users/bassosimone/following{/other_user}","gists_url":"https://api.github.com/users/bassosimone/gists{/gist_id}","starred_url":"https://api.github.com/users/bassosimone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bassosimone/subscriptions","organizations_url":"https://api.github.com/users/bassosimone/orgs","repos_url":"https://api.github.com/users/bassosimone/repos","events_url":"https://api.github.com/users/bassosimone/events{/privacy}","received_events_url":"https://api.github.com/users/bassosimone/received_events","type":"User","site_admin":false},"body":"@AntonioLangiu, in any case, I am fine with exceptions used like this. What makes me uncomfortable is mixing exceptions usage and calling callbacks (especially because also the callbacks may except).","created_at":"2016-12-16T12:12:00Z","updated_at":"2016-12-16T12:12:00Z","html_url":"https://github.com/measurement-kit/measurement-kit/pull/967#discussion_r92801662","pull_request_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967","_links":{"self":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/comments/92801662"},"html":{"href":"https://github.com/measurement-kit/measurement-kit/pull/967#discussion_r92801662"},"pull_request":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967"}}},"pull_request":{"url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967","id":95197571,"html_url":"https://github.com/measurement-kit/measurement-kit/pull/967","diff_url":"https://github.com/measurement-kit/measurement-kit/pull/967.diff","patch_url":"https://github.com/measurement-kit/measurement-kit/pull/967.patch","issue_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/967","number":967,"state":"open","locked":false,"title":"Add OONI bouncer support","user":{"login":"AntonioLangiu","id":4649406,"avatar_url":"https://avatars.githubusercontent.com/u/4649406?v=3","gravatar_id":"","url":"https://api.github.com/users/AntonioLangiu","html_url":"https://github.com/AntonioLangiu","followers_url":"https://api.github.com/users/AntonioLangiu/followers","following_url":"https://api.github.com/users/AntonioLangiu/following{/other_user}","gists_url":"https://api.github.com/users/AntonioLangiu/gists{/gist_id}","starred_url":"https://api.github.com/users/AntonioLangiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AntonioLangiu/subscriptions","organizations_url":"https://api.github.com/users/AntonioLangiu/orgs","repos_url":"https://api.github.com/users/AntonioLangiu/repos","events_url":"https://api.github.com/users/AntonioLangiu/events{/privacy}","received_events_url":"https://api.github.com/users/AntonioLangiu/received_events","type":"User","site_admin":false},"body":"Add OONI bouncer support as exaplained in #693 ","created_at":"2016-11-24T15:32:41Z","updated_at":"2016-12-16T12:12:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72b0f202927d80a87962be8e8845f62436b07aa8","assignee":{"login":"AntonioLangiu","id":4649406,"avatar_url":"https://avatars.githubusercontent.com/u/4649406?v=3","gravatar_id":"","url":"https://api.github.com/users/AntonioLangiu","html_url":"https://github.com/AntonioLangiu","followers_url":"https://api.github.com/users/AntonioLangiu/followers","following_url":"https://api.github.com/users/AntonioLangiu/following{/other_user}","gists_url":"https://api.github.com/users/AntonioLangiu/gists{/gist_id}","starred_url":"https://api.github.com/users/AntonioLangiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AntonioLangiu/subscriptions","organizations_url":"https://api.github.com/users/AntonioLangiu/orgs","repos_url":"https://api.github.com/users/AntonioLangiu/repos","events_url":"https://api.github.com/users/AntonioLangiu/events{/privacy}","received_events_url":"https://api.github.com/users/AntonioLangiu/received_events","type":"User","site_admin":false},"assignees":[{"login":"AntonioLangiu","id":4649406,"avatar_url":"https://avatars.githubusercontent.com/u/4649406?v=3","gravatar_id":"","url":"https://api.github.com/users/AntonioLangiu","html_url":"https://github.com/AntonioLangiu","followers_url":"https://api.github.com/users/AntonioLangiu/followers","following_url":"https://api.github.com/users/AntonioLangiu/following{/other_user}","gists_url":"https://api.github.com/users/AntonioLangiu/gists{/gist_id}","starred_url":"https://api.github.com/users/AntonioLangiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AntonioLangiu/subscriptions","organizations_url":"https://api.github.com/users/AntonioLangiu/orgs","repos_url":"https://api.github.com/users/AntonioLangiu/repos","events_url":"https://api.github.com/users/AntonioLangiu/events{/privacy}","received_events_url":"https://api.github.com/users/AntonioLangiu/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967/commits","review_comments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967/comments","review_comment_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/967/comments","statuses_url":"https://api.github.com/repos/measurement-kit/measurement-kit/statuses/f4c67f1e7639128ce8d2300f3102d6316621ecb3","head":{"label":"measurement-kit:feature/add_ooni_bouncer","ref":"feature/add_ooni_bouncer","sha":"f4c67f1e7639128ce8d2300f3102d6316621ecb3","user":{"login":"measurement-kit","id":11982841,"avatar_url":"https://avatars.githubusercontent.com/u/11982841?v=3","gravatar_id":"","url":"https://api.github.com/users/measurement-kit","html_url":"https://github.com/measurement-kit","followers_url":"https://api.github.com/users/measurement-kit/followers","following_url":"https://api.github.com/users/measurement-kit/following{/other_user}","gists_url":"https://api.github.com/users/measurement-kit/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-kit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-kit/subscriptions","organizations_url":"https://api.github.com/users/measurement-kit/orgs","repos_url":"https://api.github.com/users/measurement-kit/repos","events_url":"https://api.github.com/users/measurement-kit/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-kit/received_events","type":"Organization","site_admin":false},"repo":{"id":20287787,"name":"measurement-kit","full_name":"measurement-kit/measurement-kit","owner":{"login":"measurement-kit","id":11982841,"avatar_url":"https://avatars.githubusercontent.com/u/11982841?v=3","gravatar_id":"","url":"https://api.github.com/users/measurement-kit","html_url":"https://github.com/measurement-kit","followers_url":"https://api.github.com/users/measurement-kit/followers","following_url":"https://api.github.com/users/measurement-kit/following{/other_user}","gists_url":"https://api.github.com/users/measurement-kit/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-kit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-kit/subscriptions","organizations_url":"https://api.github.com/users/measurement-kit/orgs","repos_url":"https://api.github.com/users/measurement-kit/repos","events_url":"https://api.github.com/users/measurement-kit/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-kit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/measurement-kit/measurement-kit","description":"Portable C++11 network measurement library","fork":false,"url":"https://api.github.com/repos/measurement-kit/measurement-kit","forks_url":"https://api.github.com/repos/measurement-kit/measurement-kit/forks","keys_url":"https://api.github.com/repos/measurement-kit/measurement-kit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/measurement-kit/measurement-kit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/measurement-kit/measurement-kit/teams","hooks_url":"https://api.github.com/repos/measurement-kit/measurement-kit/hooks","issue_events_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/events{/number}","events_url":"https://api.github.com/repos/measurement-kit/measurement-kit/events","assignees_url":"https://api.github.com/repos/measurement-kit/measurement-kit/assignees{/user}","branches_url":"https://api.github.com/repos/measurement-kit/measurement-kit/branches{/branch}","tags_url":"https://api.github.com/repos/measurement-kit/measurement-kit/tags","blobs_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/refs{/sha}","trees_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/measurement-kit/measurement-kit/statuses/{sha}","languages_url":"https://api.github.com/repos/measurement-kit/measurement-kit/languages","stargazers_url":"https://api.github.com/repos/measurement-kit/measurement-kit/stargazers","contributors_url":"https://api.github.com/repos/measurement-kit/measurement-kit/contributors","subscribers_url":"https://api.github.com/repos/measurement-kit/measurement-kit/subscribers","subscription_url":"https://api.github.com/repos/measurement-kit/measurement-kit/subscription","commits_url":"https://api.github.com/repos/measurement-kit/measurement-kit/commits{/sha}","git_commits_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/commits{/sha}","comments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/comments{/number}","issue_comment_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/comments{/number}","contents_url":"https://api.github.com/repos/measurement-kit/measurement-kit/contents/{+path}","compare_url":"https://api.github.com/repos/measurement-kit/measurement-kit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/measurement-kit/measurement-kit/merges","archive_url":"https://api.github.com/repos/measurement-kit/measurement-kit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/measurement-kit/measurement-kit/downloads","issues_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues{/number}","pulls_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls{/number}","milestones_url":"https://api.github.com/repos/measurement-kit/measurement-kit/milestones{/number}","notifications_url":"https://api.github.com/repos/measurement-kit/measurement-kit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/measurement-kit/measurement-kit/labels{/name}","releases_url":"https://api.github.com/repos/measurement-kit/measurement-kit/releases{/id}","deployments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/deployments","created_at":"2014-05-29T08:44:43Z","updated_at":"2016-12-03T21:53:52Z","pushed_at":"2016-12-16T09:43:40Z","git_url":"git://github.com/measurement-kit/measurement-kit.git","ssh_url":"git@github.com:measurement-kit/measurement-kit.git","clone_url":"https://github.com/measurement-kit/measurement-kit.git","svn_url":"https://github.com/measurement-kit/measurement-kit","homepage":"https://measurement-kit.github.io/","size":12058,"stargazers_count":23,"watchers_count":23,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":102,"forks":6,"open_issues":102,"watchers":23,"default_branch":"master"}},"base":{"label":"measurement-kit:master","ref":"master","sha":"9822ae6fd3f4ba8b1367019167c6391f6c173531","user":{"login":"measurement-kit","id":11982841,"avatar_url":"https://avatars.githubusercontent.com/u/11982841?v=3","gravatar_id":"","url":"https://api.github.com/users/measurement-kit","html_url":"https://github.com/measurement-kit","followers_url":"https://api.github.com/users/measurement-kit/followers","following_url":"https://api.github.com/users/measurement-kit/following{/other_user}","gists_url":"https://api.github.com/users/measurement-kit/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-kit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-kit/subscriptions","organizations_url":"https://api.github.com/users/measurement-kit/orgs","repos_url":"https://api.github.com/users/measurement-kit/repos","events_url":"https://api.github.com/users/measurement-kit/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-kit/received_events","type":"Organization","site_admin":false},"repo":{"id":20287787,"name":"measurement-kit","full_name":"measurement-kit/measurement-kit","owner":{"login":"measurement-kit","id":11982841,"avatar_url":"https://avatars.githubusercontent.com/u/11982841?v=3","gravatar_id":"","url":"https://api.github.com/users/measurement-kit","html_url":"https://github.com/measurement-kit","followers_url":"https://api.github.com/users/measurement-kit/followers","following_url":"https://api.github.com/users/measurement-kit/following{/other_user}","gists_url":"https://api.github.com/users/measurement-kit/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-kit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-kit/subscriptions","organizations_url":"https://api.github.com/users/measurement-kit/orgs","repos_url":"https://api.github.com/users/measurement-kit/repos","events_url":"https://api.github.com/users/measurement-kit/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-kit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/measurement-kit/measurement-kit","description":"Portable C++11 network measurement library","fork":false,"url":"https://api.github.com/repos/measurement-kit/measurement-kit","forks_url":"https://api.github.com/repos/measurement-kit/measurement-kit/forks","keys_url":"https://api.github.com/repos/measurement-kit/measurement-kit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/measurement-kit/measurement-kit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/measurement-kit/measurement-kit/teams","hooks_url":"https://api.github.com/repos/measurement-kit/measurement-kit/hooks","issue_events_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/events{/number}","events_url":"https://api.github.com/repos/measurement-kit/measurement-kit/events","assignees_url":"https://api.github.com/repos/measurement-kit/measurement-kit/assignees{/user}","branches_url":"https://api.github.com/repos/measurement-kit/measurement-kit/branches{/branch}","tags_url":"https://api.github.com/repos/measurement-kit/measurement-kit/tags","blobs_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/refs{/sha}","trees_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/measurement-kit/measurement-kit/statuses/{sha}","languages_url":"https://api.github.com/repos/measurement-kit/measurement-kit/languages","stargazers_url":"https://api.github.com/repos/measurement-kit/measurement-kit/stargazers","contributors_url":"https://api.github.com/repos/measurement-kit/measurement-kit/contributors","subscribers_url":"https://api.github.com/repos/measurement-kit/measurement-kit/subscribers","subscription_url":"https://api.github.com/repos/measurement-kit/measurement-kit/subscription","commits_url":"https://api.github.com/repos/measurement-kit/measurement-kit/commits{/sha}","git_commits_url":"https://api.github.com/repos/measurement-kit/measurement-kit/git/commits{/sha}","comments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/comments{/number}","issue_comment_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/comments{/number}","contents_url":"https://api.github.com/repos/measurement-kit/measurement-kit/contents/{+path}","compare_url":"https://api.github.com/repos/measurement-kit/measurement-kit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/measurement-kit/measurement-kit/merges","archive_url":"https://api.github.com/repos/measurement-kit/measurement-kit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/measurement-kit/measurement-kit/downloads","issues_url":"https://api.github.com/repos/measurement-kit/measurement-kit/issues{/number}","pulls_url":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls{/number}","milestones_url":"https://api.github.com/repos/measurement-kit/measurement-kit/milestones{/number}","notifications_url":"https://api.github.com/repos/measurement-kit/measurement-kit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/measurement-kit/measurement-kit/labels{/name}","releases_url":"https://api.github.com/repos/measurement-kit/measurement-kit/releases{/id}","deployments_url":"https://api.github.com/repos/measurement-kit/measurement-kit/deployments","created_at":"2014-05-29T08:44:43Z","updated_at":"2016-12-03T21:53:52Z","pushed_at":"2016-12-16T09:43:40Z","git_url":"git://github.com/measurement-kit/measurement-kit.git","ssh_url":"git@github.com:measurement-kit/measurement-kit.git","clone_url":"https://github.com/measurement-kit/measurement-kit.git","svn_url":"https://github.com/measurement-kit/measurement-kit","homepage":"https://measurement-kit.github.io/","size":12058,"stargazers_count":23,"watchers_count":23,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":102,"forks":6,"open_issues":102,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967"},"html":{"href":"https://github.com/measurement-kit/measurement-kit/pull/967"},"issue":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/967"},"comments":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/issues/967/comments"},"review_comments":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967/comments"},"review_comment":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/pulls/967/commits"},"statuses":{"href":"https://api.github.com/repos/measurement-kit/measurement-kit/statuses/f4c67f1e7639128ce8d2300f3102d6316621ecb3"}}}}
{"actor":{"display_login":"bassosimone"}}