diff mercurial/bundle2.py @ 21179:372f4772f7a0 stable

bundle2: use a more specific UnknownPartError when no handler is found KeyError is very generic, we need something more specific for proper error handling.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 21 Apr 2014 19:42:40 -0700
parents 952af771bc17
children 4345274adc4b
line wrap: on
line diff
--- 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()