Changeset 1676:441d337b2878


Ignore:
Timestamp:
Oct 28, 2017, 6:38:46 PM (14 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
amend_source:
3f05172a55a12beaf4ef7bc67ee4eae6878fa544
Message:
Reorder caught exceptions in `_available_child`

Change the order of caught exceptions in `FTPHost._available_child`.
Put the errors in the `ftplib` namespace first, but otherwise order
the exception classes alphabetically by their names.

In general, when reordering exceptions you have to watch out for
inheritance relationships (catch subclasses before their base
classes). However, there doesn't seem to be any inheritance issue with
the given exceptions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1675 r1676  
    166166                try:
    167167                    host._session.pwd()
    168                 # Timed-out sessions raise `error_temp`.
    169                 except ftplib.error_temp:
    170                     continue
    171168                # Under high load, a 226 status response from a
    172169                # previous download may arrive too late, so that it's
     
    176173                except ftplib.error_reply:
    177174                    continue
     175                # Timed-out sessions raise `error_temp`.
     176                except ftplib.error_temp:
     177                    continue
     178                # The server may have closed the connection which may
     179                # cause `host._session.getline` to raise an `EOFError`
     180                # (see ticket #114).
     181                except EOFError:
     182                    continue
    178183                # Under high load, there may be a socket read timeout
    179184                # during the last FTP file `close` (see ticket #112).
     
    181186                # an FTP session timeout.
    182187                except OSError:
    183                     continue
    184                 # The server may have closed the connection which may
    185                 # cause `host._session.getline` to raise an `EOFError`
    186                 # (see ticket #114).
    187                 except EOFError:
    188188                    continue
    189189                else:
Note: See TracChangeset for help on using the changeset viewer.