Skip to content

Commit 9f3fc25

Browse files
FlamefireThyre
authored andcommitted
Catch HTTPException when doing GitHub API request
The REST API (can?) use `http.client` via `request` which may fail at that level with a `HTTPException`. E.g.: > http.client.RemoteDisconnected: Remote end closed connection without response Catch that to report better errors.
1 parent 5853755 commit 9f3fc25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

easybuild/tools/github.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import tempfile
4545
import time
4646
from datetime import datetime, timedelta
47+
from http.client import HTTPException
4748
from string import ascii_letters
4849
from urllib.request import HTTPError, URLError, urlopen
4950

@@ -281,7 +282,7 @@ def github_api_get_request(request_f, github_user=None, token=None, **kwargs):
281282

282283
try:
283284
status, data = url.get(**kwargs)
284-
except socket.gaierror as err:
285+
except (socket.gaierror, HTTPException) as err:
285286
_log.warning("Error occurred while performing get request: %s", err)
286287
status, data = 0, None
287288

0 commit comments

Comments
 (0)