Add tests for exceptions and refactor download_connection_error

Closes #6.