Mercurial > public > mercurial-scm > hg
comparison mercurial/error.py @ 25484:a5192774e925
bundle2: introduce a PushkeyFail error to abort unbundle on pushkey error
The pushkey code is generic and the server side has little context on what the
client is trying to achieve. Generating interesting error messages server side
would be challenging. Instead we introduce a dedicated exception that carries more
data. In particular, it carries the id of the part which failed that will allow
clients to display custom error messages depending on the part intent.
The processing and transfer-over-the-wire of this exception is to be implemented
in coming changesets.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 27 May 2015 23:48:54 -0700 |
parents | 4311e78a4609 |
children | 147bd9e238a1 |
comparison
equal
deleted
inserted
replaced
25483:fb04372d7b38 | 25484:a5192774e925 |
---|---|
149 | 149 |
150 class ReadOnlyPartError(RuntimeError): | 150 class ReadOnlyPartError(RuntimeError): |
151 """error raised when code tries to alter a part being generated""" | 151 """error raised when code tries to alter a part being generated""" |
152 pass | 152 pass |
153 | 153 |
154 class PushkeyFailed(Abort): | |
155 """error raised when a pushkey part failed to update a value""" | |
156 | |
157 def __init__(self, partid, namespace=None, key=None, new=None, old=None, | |
158 ret=None): | |
159 self.partid = partid | |
160 self.namespace = namespace | |
161 self.key = key | |
162 self.new = new | |
163 self.old = old | |
164 self.ret = ret | |
165 # no i18n expected to be processed into a better message | |
166 Abort.__init__(self, 'failed to update value for "%s/%s"' | |
167 % (namespace, key)) | |
168 | |
154 class CensoredNodeError(RevlogError): | 169 class CensoredNodeError(RevlogError): |
155 """error raised when content verification fails on a censored node | 170 """error raised when content verification fails on a censored node |
156 | 171 |
157 Also contains the tombstone data substituted for the uncensored data. | 172 Also contains the tombstone data substituted for the uncensored data. |
158 """ | 173 """ |