The FTPError
class and some other code in the ftputil.error
module
use a keyword argument original_exception
. Since ftputil now targets
only Python 3.6+ and Python 3 has exception chaining, we don't need a
custom mechanism to refer to previous exceptions.
Subtasks:
- Remove
tool.as_bytes
. This doesn't seem to be needed (recheck though)- Remove
tool.same_string_type_as
if possible- Remove handling of
bytes
as error strings. Assume that on Python 3, error strings in exceptions are alwaysstr
- Change
tool.as_str
into two functions:
as_str
: like the currentas_str
, but without theos.fspath
conversionas_str_path
: like the currentas_str
The idea is that you wouldn't expect the
os.fspath
call from a nameas_str
. The current design mixes up the concept of the conversion tostr
with the use for paths.
As it turned out,
original_exception
wasn't used for exception chaining, but only to accessstr(original_exception)
, which not always is the same asoriginal_exception.args[0]
. For example, theargs
ofsocket.gaierror
may be(-2, "Name or service not known")
.On the other hand, a few more changes were necessary in other areas, but this clearly led to improvements.
In my opinion, the ticket can be closed as of 388435f439d10b49f33db787895c267e9e462412. :-)