mirror of
https://opendev.org/x/pyghmi
synced 2025-08-31 15:28:07 +00:00
Fix download error reporting
Threaded downloads now store the exception for passing to the caller. Change-Id: Ibe4a7a267b04a2775ad3775dd904a4e3c7520ebb
This commit is contained in:
@@ -1018,6 +1018,8 @@ class XCCClient(IMMClient):
|
||||
progress({'phase': 'download',
|
||||
'progress': 100 * self.wc.get_download_progress()})
|
||||
self._refresh_token()
|
||||
if fd.exc:
|
||||
raise fd.exc
|
||||
if progress:
|
||||
progress({'phase': 'complete'})
|
||||
return savefile
|
||||
|
@@ -716,6 +716,8 @@ class OEMHandler(generic.OEMHandler):
|
||||
progress({'phase': 'download',
|
||||
'progress': 100 * self.wc.get_download_progress()})
|
||||
self._refresh_token()
|
||||
if fd.exc:
|
||||
raise fd.exc
|
||||
if progress:
|
||||
progress({'phase': 'complete'})
|
||||
return savefile
|
||||
|
@@ -74,10 +74,14 @@ class FileDownloader(threading.Thread):
|
||||
self.wc = webclient
|
||||
self.url = url
|
||||
self.savefile = savefile
|
||||
self.exc = None
|
||||
super(FileDownloader, self).__init__()
|
||||
|
||||
def run(self):
|
||||
self.wc.download(self.url, self.savefile)
|
||||
try:
|
||||
self.wc.download(self.url, self.savefile)
|
||||
except Exception as e:
|
||||
self.exc = e
|
||||
|
||||
|
||||
def get_upload_form(filename, data, formname, otherfields):
|
||||
|
Reference in New Issue
Block a user