summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorJeremy Hylton <32469542+jeremyhylton@users.noreply.github.com>2024-08-20 00:35:05 (GMT)
committerGitHub <noreply@github.com>2024-08-20 00:35:05 (GMT)
commit77133f570dcad599e5b1199c39e999bfac959ae2 (patch)
tree5429953945e935f54bca37487bf9a2867b8d8198 /Lib/urllib/request.py
parent0480052ea1567d50e9772b836bc9f90bee11c2f7 (diff)
downloadcpython-77133f570dcad599e5b1199c39e999bfac959ae2.zip
cpython-77133f570dcad599e5b1199c39e999bfac959ae2.tar.gz
cpython-77133f570dcad599e5b1199c39e999bfac959ae2.tar.bz2
gh-122909: Pass ftp error strings to URLError constructor (#122913)
* pass the original string error message from the ftplib error to URLError() * Update request.py Change error string for ftp error to be consistent with other errors reported for ftp * Add NEWS entry for change to urllib.request for ftp errors. * Track the change in the ftp error message in the test.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 58b0cb5..bc35d8a 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1555,7 +1555,7 @@ class FTPHandler(BaseHandler):
headers = email.message_from_string(headers)
return addinfourl(fp, headers, req.full_url)
except ftplib.all_errors as exp:
- raise URLError(exp) from exp
+ raise URLError(f"ftp error: {exp}") from exp
def connect_ftp(self, user, passwd, host, port, dirs, timeout):
return ftpwrapper(user, passwd, host, port, dirs, timeout,