From c51ff717d9bdfed86e604af1cbbaf2870176f031 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 10 Jun 2014 21:04:39 -0500 Subject: Use last element in args tuple as error message When things blow up in low-level C code, the tuple is sometimes of length one, such as when it contains this error message: _ssl.c:495: The handshake operation timed out Just use the last element of the tuple, which works for all of the cases. Signed-off-by: Dan McGee --- mirrors/management/commands/mirrorcheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index e48aa42..d2a27be 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -139,7 +139,7 @@ def check_mirror_url(mirror_url, location, timeout): if isinstance(e.reason, socket.timeout): log.error = "Connection timed out." elif isinstance(e.reason, socket.error): - log.error = e.reason.args[1] + log.error = e.reason.args[-1] logger.debug("failed: %s, %s", url, log.error) except HTTPException: # e.g., BadStatusLine -- cgit v1.2.3-24-g4f1b