nebbles / gitcommit

a tool for writing conventional commits, conveniently
GNU General Public License v3.0
14 stars 2 forks source link

Network error catching refactor #43

Open nebbles opened 4 years ago

nebbles commented 4 years ago

Network exception was thrown when checking for updates. This should be refactored to show more useful errors related to networking.

Note that this was already emergency patched in 6f426d1.

Traceback below (submitted by @pa17)

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 588, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 248, in _get_conn
    return conn or self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 826, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/nebbles/gitcommit/tags (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gitcommit", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/gitcommit/gitcommit.py", line 396, in main
    run()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/gitcommit.py", line 391, in run
    check_for_update()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/updater.py", line 37, in check_for_update
    tags = get_github_tags()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/updater.py", line 12, in get_github_tags
    resp = requests.get("https://api.github.com/repos/nebbles/gitcommit/tags")
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/nebbles/gitcommit/tags (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
nebbles commented 4 years ago

Needs a debug mode for showing types of errors when debug mode is enabled. Debug mode needs to be implemented by #26