git://git.jankratochvil.net
/
youtube-dl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
802622a
)
Robust error handling in downloading code
author
Philipp Hagemeister
<phihag@phihag.de>
Sat, 3 Sep 2011 09:32:05 +0000
(11:32 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Sat, 3 Sep 2011 09:32:05 +0000
(11:32 +0200)
youtube-dl
patch
|
blob
|
history
diff --git
a/youtube-dl
b/youtube-dl
index
68c9bc4
..
3f45e92
100755
(executable)
--- a/
youtube-dl
+++ b/
youtube-dl
@@
-930,6
+930,7
@@
class FileDownloader(object):
if stream is None:
try:
(stream, tmpfilename) = sanitize_open(tmpfilename, open_mode)
if stream is None:
try:
(stream, tmpfilename) = sanitize_open(tmpfilename, open_mode)
+ assert stream is not None
filename = self.undo_temp_name(tmpfilename)
self.report_destination(filename)
except (OSError, IOError), err:
filename = self.undo_temp_name(tmpfilename)
self.report_destination(filename)
except (OSError, IOError), err:
@@
-951,6
+952,9
@@
class FileDownloader(object):
# Apply rate limit
self.slow_down(start, byte_counter - resume_len)
# Apply rate limit
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()
self.report_finish()
if data_len is not None and byte_counter != data_len:
stream.close()
self.report_finish()
if data_len is not None and byte_counter != data_len: