bundle2: rename error exception class for unsupported feature
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 23 Sep 2015 11:44:52 -0700
changeset 26393 cff70549a959
parent 26392 127b59787fd5
child 26394 e75da738add5
bundle2: rename error exception class for unsupported feature The original name explicitly mention "Part", however it is also used outside of parts related feature. We rename from 'UnsupportedPartError' to 'BundleUnknownFeatureError' to fix this.
mercurial/bundle2.py
mercurial/error.py
--- a/mercurial/bundle2.py	Wed Sep 23 11:33:30 2015 -0700
+++ b/mercurial/bundle2.py	Wed Sep 23 11:44:52 2015 -0700
@@ -376,17 +376,17 @@
             handler = parthandlermapping.get(part.type)
             if handler is None:
                 status = 'unsupported-type'
-                raise error.UnsupportedPartError(parttype=part.type)
+                raise error.BundleUnknownFeatureError(parttype=part.type)
             indebug(op.ui, 'found a handler for part %r' % part.type)
             unknownparams = part.mandatorykeys - handler.params
             if unknownparams:
                 unknownparams = list(unknownparams)
                 unknownparams.sort()
                 status = 'unsupported-params (%s)' % unknownparams
-                raise error.UnsupportedPartError(parttype=part.type,
-                                               params=unknownparams)
+                raise error.BundleUnknownFeatureError(parttype=part.type,
+                                                      params=unknownparams)
             status = 'supported'
-        except error.UnsupportedPartError as exc:
+        except error.BundleUnknownFeatureError as exc:
             if part.mandatory: # mandatory parts
                 raise
             indebug(op.ui, 'ignoring unsupported advisory part %s' % exc)
@@ -666,7 +666,7 @@
         if name[0].islower():
             indebug(self.ui, "ignoring unknown parameter %r" % name)
         else:
-            raise error.UnsupportedPartError(params=(name,))
+            raise error.BundleUnknownFeatureError(params=(name,))
 
 
     def iterparts(self):
@@ -1329,7 +1329,7 @@
     if params is not None:
         kwargs['params'] = params.split('\0')
 
-    raise error.UnsupportedPartError(**kwargs)
+    raise error.BundleUnknownFeatureError(**kwargs)
 
 @parthandler('error:pushraced', ('message',))
 def handleerrorpushraced(op, inpart):
--- a/mercurial/error.py	Wed Sep 23 11:33:30 2015 -0700
+++ b/mercurial/error.py	Wed Sep 23 11:44:52 2015 -0700
@@ -141,7 +141,7 @@
 class BundleValueError(ValueError):
     """error raised when bundle2 cannot be processed"""
 
-class UnsupportedPartError(BundleValueError):
+class BundleUnknownFeatureError(BundleValueError):
     def __init__(self, parttype=None, params=()):
         self.parttype = parttype
         self.params = params