Fix bug in dockerloadformat and make sure we handle exceptions properly in the verb call
This commit is contained in:
parent
c34a8b6727
commit
d16fdde528
4 changed files with 35 additions and 7 deletions
|
@ -12,6 +12,11 @@ class QueueFile(object):
|
|||
self._buffer = ''
|
||||
self._total_size = 0
|
||||
self._name = name
|
||||
self.raised_exception = False
|
||||
self._exception_handlers = []
|
||||
|
||||
def add_exception_handler(self, handler):
|
||||
self._exception_handlers.append(handler)
|
||||
|
||||
def read(self, size=8192):
|
||||
if self._closed or self._done:
|
||||
|
@ -25,7 +30,11 @@ class QueueFile(object):
|
|||
|
||||
if isinstance(result, Exception):
|
||||
self._closed = True
|
||||
raise result
|
||||
self.raised_exception = True
|
||||
for handler in self._exception_handlers:
|
||||
handler(result)
|
||||
|
||||
return
|
||||
|
||||
self._buffer += result
|
||||
self._total_size += len(result)
|
||||
|
|
Reference in a new issue