comparison sat/tools/stream.py @ 3924:e4631d073c8b

tools (stream): log error when a SatFile is closed: error where only sent on `ProgressError`, but it is necessary to log the error as it may happen before any progression is started.
author Goffi <goffi@goffi.org>
date Thu, 06 Oct 2022 16:02:05 +0200
parents 7550ae9cfbac
children 0dd79c6cc1d2
comparison
equal deleted inserted replaced
3923:13a2403774d4 3924:e4631d073c8b
61 @param auto_end_signals(bool): if True, progressFinished and progressError signals 61 @param auto_end_signals(bool): if True, progressFinished and progressError signals
62 are automatically sent. 62 are automatically sent.
63 if False, you'll have to call self.progressFinished and self.progressError 63 if False, you'll have to call self.progressFinished and self.progressError
64 yourself. 64 yourself.
65 progressStarted signal is always sent automatically 65 progressStarted signal is always sent automatically
66 @param check_size_with_read(bool): if True, size well be checked using number of 66 @param check_size_with_read(bool): if True, size will be checked using number of
67 bytes read or written. This is useful when data_cb modifiy len of file. 67 bytes read or written. This is useful when data_cb modifiy len of file.
68 """ 68 """
69 self.host = host 69 self.host = host
70 self.profile = client.profile 70 self.profile = client.profile
71 self.uid = uid or str(uuid.uuid4()) 71 self.uid = uid or str(uuid.uuid4())
137 else: 137 else:
138 assert progress_metadata is None 138 assert progress_metadata is None
139 self.progressError(error) 139 self.progressError(error)
140 140
141 self.host.removeProgressCb(self.uid, self.profile) 141 self.host.removeProgressCb(self.uid, self.profile)
142 if error is not None:
143 log.error(f"file {self._file} closed with an error: {error}")
142 144
143 @property 145 @property
144 def closed(self): 146 def closed(self):
145 return self._file.closed 147 return self._file.closed
146 148