Mercurial > hg
comparison mercurial/error.py @ 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 | 3e8bcc90f07c |
comparison
equal
deleted
inserted
replaced
21620:6eaa71b2a3cc | 21621:b6eb56a9335d |
---|---|
98 class PushRaced(RuntimeError): | 98 class PushRaced(RuntimeError): |
99 """An exception raised during unbundling that indicate a push race""" | 99 """An exception raised during unbundling that indicate a push race""" |
100 | 100 |
101 # bundle2 related errors | 101 # bundle2 related errors |
102 class BundleValueError(ValueError): | 102 class BundleValueError(ValueError): |
103 """error raised when bundle2 cannot be processed | 103 """error raised when bundle2 cannot be processed""" |
104 | 104 |
105 Current main usecase is unsupported part types.""" | 105 def __init__(self, parttype, params=()): |
106 | |
107 def __init__(self, parttype): | |
108 self.parttype = parttype | 106 self.parttype = parttype |
109 super(BundleValueError, self).__init__(parttype) | 107 self.params = params |
108 msg = parttype | |
109 if self.params: | |
110 msg = '%s - %s' % (msg, ', '.join(self.params)) | |
111 super(BundleValueError, self).__init__(msg) | |
110 | 112 |
111 class ReadOnlyPartError(RuntimeError): | 113 class ReadOnlyPartError(RuntimeError): |
112 """error raised when code tries to alter a part being generated""" | 114 """error raised when code tries to alter a part being generated""" |
113 pass | 115 pass |
114 | 116 |