mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
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.
This commit is contained in:
parent
0480052ea1
commit
77133f570d
3 changed files with 26 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue