Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.py @ 21617:0cfda08afd24
bundle2: rename UnknownPartError to BundleValueError
We are going to raise exceptions for a wider range of cases: unsupported
mandatory stream and part parameters. We rename the exception with a wider
name.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 28 May 2014 14:22:24 -0700 |
parents | f221eb0531d9 |
children | 7568f5c1c801 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Tue May 27 17:04:48 2014 -0500 +++ b/mercurial/bundle2.py Wed May 28 14:22:24 2014 -0700 @@ -172,8 +172,10 @@ """ return '>'+('BB'*nbparams) -class UnknownPartError(KeyError): - """error raised when no handler is found for a Mandatory part""" +class BundleValueError(ValueError): + """error raised when bundle2 cannot be processed + + Current main usecase is unsupported part types.""" pass class ReadOnlyPartError(RuntimeError): @@ -307,7 +309,7 @@ if key != parttype: # mandatory parts # todo: # - use a more precise exception - raise UnknownPartError(key) + raise BundleValueError(key) op.ui.debug('ignoring unknown advisory part %r\n' % key) # consuming the part part.read() @@ -839,7 +841,7 @@ @parthandler('b2x:error:unknownpart') def handlereplycaps(op, inpart): """Used to transmit unknown part error over the wire""" - raise UnknownPartError(inpart.params['parttype']) + raise BundleValueError(inpart.params['parttype']) @parthandler('b2x:error:pushraced') def handlereplycaps(op, inpart):