changeset 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 9a813e703172
children b056777221bf
files mercurial/bundle2.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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()