Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/error.py @ 21627:3e8bcc90f07c
bundle2: support None parttype in BundleValueError
This will be used for errors at the stream level.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 28 May 2014 16:46:58 -0700 |
parents | b6eb56a9335d |
children | fecead61d222 |
comparison
equal
deleted
inserted
replaced
21626:985d139c8e8f | 21627:3e8bcc90f07c |
---|---|
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 def __init__(self, parttype, params=()): | 105 def __init__(self, parttype=None, params=()): |
106 self.parttype = parttype | 106 self.parttype = parttype |
107 self.params = params | 107 self.params = params |
108 msg = parttype | 108 if self.parttype is None: |
109 msg = 'Stream Parameter' | |
110 else: | |
111 msg = parttype | |
109 if self.params: | 112 if self.params: |
110 msg = '%s - %s' % (msg, ', '.join(self.params)) | 113 msg = '%s - %s' % (msg, ', '.join(self.params)) |
111 super(BundleValueError, self).__init__(msg) | 114 super(BundleValueError, self).__init__(msg) |
112 | 115 |
113 class ReadOnlyPartError(RuntimeError): | 116 class ReadOnlyPartError(RuntimeError): |