changeset 21621:b6eb56a9335d

bundle2: introduce a ``params`` attribute to BundleValueError We'll first use it for unsupported mandatory parameters on parts.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 28 May 2014 15:53:34 -0700
parents 6eaa71b2a3cc
children 457492741007
files mercurial/error.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/error.py	Wed May 28 15:51:19 2014 -0700
+++ b/mercurial/error.py	Wed May 28 15:53:34 2014 -0700
@@ -100,13 +100,15 @@
 
 # bundle2 related errors
 class BundleValueError(ValueError):
-    """error raised when bundle2 cannot be processed
-
-    Current main usecase is unsupported part types."""
+    """error raised when bundle2 cannot be processed"""
 
-    def __init__(self, parttype):
+    def __init__(self, parttype, params=()):
         self.parttype = parttype
-        super(BundleValueError, self).__init__(parttype)
+        self.params = params
+        msg = parttype
+        if self.params:
+            msg = '%s - %s' % (msg, ', '.join(self.params))
+        super(BundleValueError, self).__init__(msg)
 
 class ReadOnlyPartError(RuntimeError):
     """error raised when code tries to alter a part being generated"""