##// END OF EJS Templates
bundle2: introduce a parttype attribute to BundleValueError...
Pierre-Yves David -
r21620:6eaa71b2 default
parent child Browse files
Show More
@@ -299,7 +299,7 b' def processbundle(repo, unbundler, trans'
299 299 if key != parttype: # mandatory parts
300 300 # todo:
301 301 # - use a more precise exception
302 raise error.BundleValueError(key)
302 raise error.BundleValueError(parttype=key)
303 303 op.ui.debug('ignoring unknown advisory part %r\n' % key)
304 304 # consuming the part
305 305 part.read()
@@ -831,7 +831,8 b' def handlereplycaps(op, inpart):'
831 831 @parthandler('b2x:error:unsupportedcontent')
832 832 def handlereplycaps(op, inpart):
833 833 """Used to transmit unknown content error over the wire"""
834 raise error.BundleValueError(inpart.params['parttype'])
834 parttype = inpart.params['parttype']
835 raise error.BundleValueError(parttype=parttype)
835 836
836 837 @parthandler('b2x:error:pushraced')
837 838 def handlereplycaps(op, inpart):
@@ -103,7 +103,10 b' class BundleValueError(ValueError):'
103 103 """error raised when bundle2 cannot be processed
104 104
105 105 Current main usecase is unsupported part types."""
106 pass
106
107 def __init__(self, parttype):
108 self.parttype = parttype
109 super(BundleValueError, self).__init__(parttype)
107 110
108 111 class ReadOnlyPartError(RuntimeError):
109 112 """error raised when code tries to alter a part being generated"""
@@ -806,7 +806,7 b' def unbundle(repo, proto, heads):'
806 806 except error.BundleValueError, exc:
807 807 bundler = bundle2.bundle20(repo.ui)
808 808 errpart = bundler.newpart('B2X:ERROR:UNSUPPORTEDCONTENT')
809 errpart.addparam('parttype', str(exc))
809 errpart.addparam('parttype', exc.parttype)
810 810 return streamres(bundler.getchunks())
811 811 except util.Abort, inst:
812 812 # The old code we moved used sys.stderr directly.
General Comments 0
You need to be logged in to leave comments. Login now