mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 18:22:21 +00:00
Robust error handling in downloading code
This commit is contained in:
parent
802622ac1c
commit
dbddab2799
1 changed files with 4 additions and 0 deletions
|
@ -930,6 +930,7 @@ class FileDownloader(object):
|
||||||
if stream is None:
|
if stream is None:
|
||||||
try:
|
try:
|
||||||
(stream, tmpfilename) = sanitize_open(tmpfilename, open_mode)
|
(stream, tmpfilename) = sanitize_open(tmpfilename, open_mode)
|
||||||
|
assert stream is not None
|
||||||
filename = self.undo_temp_name(tmpfilename)
|
filename = self.undo_temp_name(tmpfilename)
|
||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
except (OSError, IOError), err:
|
except (OSError, IOError), err:
|
||||||
|
@ -951,6 +952,9 @@ class FileDownloader(object):
|
||||||
# Apply rate limit
|
# Apply rate limit
|
||||||
self.slow_down(start, byte_counter - resume_len)
|
self.slow_down(start, byte_counter - resume_len)
|
||||||
|
|
||||||
|
if stream is None:
|
||||||
|
self.trouble(u'\nERROR: Did not get any data blocks')
|
||||||
|
return False
|
||||||
stream.close()
|
stream.close()
|
||||||
self.report_finish()
|
self.report_finish()
|
||||||
if data_len is not None and byte_counter != data_len:
|
if data_len is not None and byte_counter != data_len:
|
||||||
|
|
Loading…
Reference in a new issue