Clean up SegmentError messages
Since we already deducted the full length of the chunk from bytes_left before raising the too-many-bytes error, the value in the error message was always negative, like Too many bytes for /v1/AUTH_test/c%3Fwith-question-mark/dlo; truncating in /v1/AUTH_test/c with -27244 bytes left In the not-enough-bytes case, we may as well mention how many more bytes we were expecting. Change-Id: I155ed1837d40b4aaf929452b830f03c1daab0af7
This commit is contained in:
parent
0a6f0d615c
commit
f1bbb5f980
@ -515,11 +515,11 @@ class SegmentedIterable(object):
|
|||||||
'Too many bytes for %(name)s; truncating in '
|
'Too many bytes for %(name)s; truncating in '
|
||||||
'%(seg)s with %(left)d bytes left' %
|
'%(seg)s with %(left)d bytes left' %
|
||||||
{'name': self.name, 'seg': seg_name,
|
{'name': self.name, 'seg': seg_name,
|
||||||
'left': bytes_left})
|
'left': -bytes_left})
|
||||||
|
|
||||||
if bytes_left:
|
if bytes_left:
|
||||||
raise SegmentError(
|
raise SegmentError('Expected another %d bytes for %s; '
|
||||||
'Not enough bytes for %s; closing connection' % self.name)
|
'closing connection' % (bytes_left, self.name))
|
||||||
|
|
||||||
def _time_limited_iter(self):
|
def _time_limited_iter(self):
|
||||||
# Makes sure a GET response doesn't take more than self.max_get_time
|
# Makes sure a GET response doesn't take more than self.max_get_time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user