~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

[patch] Better error when sftp urls are given with invalid port numbers (Matthieu Moy)

Plus test case from me.

Show diffs side-by-side

added added

removed removed

Lines of Context:
462
462
        if self._port is None:
463
463
            self._port = 22
464
464
        else:
465
 
            self._port = int(self._port[1:])
 
465
            try:
 
466
                self._port = int(self._port[1:])
 
467
            except ValueError:
 
468
                raise SFTPTransportError('%s: invalid port number' % self._port[1:])
466
469
        if (self._path is None) or (self._path == ''):
467
470
            self._path = ''
468
471
        else: