{"action":"opened","issue":{"url":"https://api.github.com/repos/freedomofpress/securedrop-sdk/issues/34","repository_url":"https://api.github.com/repos/freedomofpress/securedrop-sdk","labels_url":"https://api.github.com/repos/freedomofpress/securedrop-sdk/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/freedomofpress/securedrop-sdk/issues/34/comments","events_url":"https://api.github.com/repos/freedomofpress/securedrop-sdk/issues/34/events","html_url":"https://github.com/freedomofpress/securedrop-sdk/issues/34","id":374376249,"node_id":"MDU6SXNzdWUzNzQzNzYyNDk=","number":34,"title":"Replace \"We should never reach here\" with an exception","user":{"login":"heartsucker","id":3998464,"node_id":"MDQ6VXNlcjM5OTg0NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3998464?v=4","gravatar_id":"","url":"https://api.github.com/users/heartsucker","html_url":"https://github.com/heartsucker","followers_url":"https://api.github.com/users/heartsucker/followers","following_url":"https://api.github.com/users/heartsucker/following{/other_user}","gists_url":"https://api.github.com/users/heartsucker/gists{/gist_id}","starred_url":"https://api.github.com/users/heartsucker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heartsucker/subscriptions","organizations_url":"https://api.github.com/users/heartsucker/orgs","repos_url":"https://api.github.com/users/heartsucker/repos","events_url":"https://api.github.com/users/heartsucker/events{/privacy}","received_events_url":"https://api.github.com/users/heartsucker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-26T13:08:39Z","updated_at":"2018-10-26T13:08:39Z","closed_at":null,"author_association":"COLLABORATOR","body":"In `Client.reply_source` there is this block:\r\n\r\n```python\r\ndef reply_source(self, source: Source, msg: str) -> bool:\r\n    # (snip)\r\n    ...\r\n        # We should never reach here\r\n        return False\r\n```\r\n\r\nIn the help docs, the `bool` is not clarified (though reading through the code makes it obvious) and exceptions are raised in other error cases. A caller to this would have to `try/catch` *and* check the result in order to properly handle all error cases.\r\n\r\n```python\r\ntry:\r\n    if not client.reply_source(my_source, my_message):\r\n        handle_error(error=None)\r\nexcept BaseError as e:\r\n    handle_error(error=e)\r\n```\r\n\r\nThis feels slightly cumbersome and could potentially lead to logic errors because the boolean error result is not checked."}}
{"actor":{"display_login":"heartsucker"}}