diff mercurial/bundle2.py @ 21620:6eaa71b2a3cc

bundle2: introduce a parttype attribute to BundleValueError We will use the Exception for more that just unknown part type.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 28 May 2014 15:51:19 -0700
parents 292331e906d7
children 457492741007
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue May 27 10:32:07 2014 -0700
+++ b/mercurial/bundle2.py	Wed May 28 15:51:19 2014 -0700
@@ -299,7 +299,7 @@
                 if key != parttype: # mandatory parts
                     # todo:
                     # - use a more precise exception
-                    raise error.BundleValueError(key)
+                    raise error.BundleValueError(parttype=key)
                 op.ui.debug('ignoring unknown advisory part %r\n' % key)
                 # consuming the part
                 part.read()
@@ -831,7 +831,8 @@
 @parthandler('b2x:error:unsupportedcontent')
 def handlereplycaps(op, inpart):
     """Used to transmit unknown content error over the wire"""
-    raise error.BundleValueError(inpart.params['parttype'])
+    parttype = inpart.params['parttype']
+    raise error.BundleValueError(parttype=parttype)
 
 @parthandler('b2x:error:pushraced')
 def handlereplycaps(op, inpart):