~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-08-18 01:29:12 UTC
  • mfrom: (5377.3.1 trivial)
  • Revision ID: pqm@pqm.ubuntu.com-20100818012912-wwgerzeui5ldf5lh
(mbp) slightly better error handling in ftp transport (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
            or 'file/directory not found' in s # filezilla server
192
192
            # Microsoft FTP-Service RNFR reply if file not found
193
193
            or (s.startswith('550 ') and 'unable to rename to' in extra)
 
194
            # if containing directory doesn't exist, suggested by
 
195
            # <https://bugs.edge.launchpad.net/bzr/+bug/224373>
 
196
            or (s.startswith('550 ') and "can't find folder" in s)
194
197
            ):
195
198
            raise errors.NoSuchFile(path, extra=extra)
196
199
        elif ('file exists' in s):
314
317
                    return len(bytes)
315
318
                else:
316
319
                    return fp.counted_bytes
317
 
            except (ftplib.error_temp,EOFError), e:
318
 
                warning("Failure during ftp PUT. Deleting temporary file.")
 
320
            except (ftplib.error_temp, EOFError), e:
 
321
                warning("Failure during ftp PUT of %s: %s. Deleting temporary file."
 
322
                    % (tmp_abspath, e, ))
319
323
                try:
320
324
                    f.delete(tmp_abspath)
321
325
                except:
328
332
                                       unknown_exc=errors.NoSuchFile)
329
333
        except ftplib.error_temp, e:
330
334
            if retries > _number_of_retries:
331
 
                raise errors.TransportError("FTP temporary error during PUT %s. Aborting."
332
 
                                     % self.abspath(relpath), orig_error=e)
 
335
                raise errors.TransportError(
 
336
                    "FTP temporary error during PUT %s: %s. Aborting."
 
337
                    % (self.abspath(relpath), e), orig_error=e)
333
338
            else:
334
339
                warning("FTP temporary error: %s. Retrying.", str(e))
335
340
                self._reconnect()