bundle2: use a more specific UnknownPartError when no handler is found
KeyError is very generic, we need something more specific for proper error
handling.
--- a/mercurial/bundle2.py Mon Apr 21 15:59:55 2014 -0700
+++ b/mercurial/bundle2.py Mon Apr 21 19:42:40 2014 -0700
@@ -170,6 +170,10 @@
"""
return '>'+('BB'*nbparams)
+class UnknownPartError(KeyError):
+ """error raised when no handler is found for a Mandatory part"""
+ pass
+
parthandlermapping = {}
def parthandler(parttype):
@@ -297,7 +301,7 @@
if key != parttype: # mandatory parts
# todo:
# - use a more precise exception
- raise
+ raise UnknownPartError(key)
op.ui.debug('ignoring unknown advisory part %r\n' % key)
# consuming the part
part.read()