Avoid tracebacks on malformed data errors.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 19 Sep 2007 12:50:40 +0000 (14:50 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 19 Sep 2007 12:50:40 +0000 (14:50 +0200)
NEWS
errors.py
tests/test_errors.py

diff --git a/NEWS b/NEWS
index 7bf67a0e1cd5e615634420590d7379902c063764..b8837d8ff2954e8d49ee9ef6926aed2dca3d7cd9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ bzr-svn 0.4.4  UNRELEASED
    * Improved import times, making bzr faster if bzr-svn is loaded but 
      not used.
 
+  IMPROVEMENTS
+   
+   * Avoid tracebacks on "Malformed data" errors.
+
 bzr-svn 0.4.3  2007-09-15
  
   PERFORMANCE
index c2712c6b504f7838dc275ab18017495f798e7859..c720354f3e3f2c3caa31be6a081df78e3b42be0b 100644 (file)
--- a/errors.py
+++ b/errors.py
@@ -18,7 +18,7 @@
 from bzrlib.errors import (BzrError, ConnectionError, ConnectionReset, 
                            LockError, NotBranchError, PermissionDenied, 
                            DependencyNotPresent, NoRepositoryPresent,
-                           UnexpectedEndOfContainerError)
+                           TransportError, UnexpectedEndOfContainerError)
 
 import svn.core
 
@@ -58,6 +58,8 @@ def convert_error(err):
         return PermissionDenied('.', msg)
     elif num == svn.core.SVN_ERR_INCOMPLETE_DATA:
         return UnexpectedEndOfContainerError()
+    elif num == svn.core.SVN_ERR_RA_SVN_MALFORMED_DATA:
+        return TransportError("Malformed data", msg)
     elif num == SVN_ERR_UNKNOWN_HOSTNAME:
         return ConnectionError(msg=msg)
     else:
index 7bd35d7d6329d8ef89ceb64840890b7726e429b8..0c4d880a7534e34b470a517974f5dfa08dbaac05 100644 (file)
@@ -15,7 +15,8 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from bzrlib.errors import (ConnectionError, ConnectionReset, LockError, 
-                           PermissionDenied, UnexpectedEndOfContainerError)
+                           PermissionDenied, TransportError,
+                           UnexpectedEndOfContainerError)
 from bzrlib.tests import TestCase
 
 from errors import (convert_svn_error, convert_error, InvalidPropertyValue, 
@@ -40,9 +41,12 @@ class TestConvertError(TestCase):
         self.assertRaises(ConnectionReset, test_throws_svn)
 
     def test_convert_error_unknown(self):
-        self.assertIsInstance(convert_error(SubversionException(100, "foo")),
+        self.assertIsInstance(convert_error(SubversionException("foo", -4)),
                 SubversionException)
 
+    def test_convert_malformed(self):
+        self.assertIsInstance(convert_error(SubversionException("foo", svn.core.SVN_ERR_RA_SVN_MALFORMED_DATA)), TransportError)
+
     def test_convert_error_reset(self):
         self.assertIsInstance(convert_error(SubversionException("Connection closed", svn.core.SVN_ERR_RA_SVN_CONNECTION_CLOSED)), ConnectionReset)