1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-18 07:05:41 +07:00

Properly convert errors to strings

This commit is contained in:
Sergey M․
2015-12-20 05:27:38 +06:00
parent fdae235858
commit 7f8b271465
6 changed files with 17 additions and 19 deletions

View File

@@ -48,6 +48,7 @@
determine_ext,
DownloadError,
encodeFilename,
error_to_str,
ExtractorError,
format_bytes,
formatSeconds,
@@ -681,7 +682,7 @@ def extract_info(self, url, download=True, ie_key=None, extra_info={},
raise
except Exception as e:
if self.params.get('ignoreerrors', False):
self.report_error(compat_str(e), tb=compat_str(traceback.format_exc()))
self.report_error(error_to_str(e), tb=compat_str(traceback.format_exc()))
break
else:
raise
@@ -1459,7 +1460,7 @@ def process_info(self, info_dict):
if dn and not os.path.exists(dn):
os.makedirs(dn)
except (OSError, IOError) as err:
self.report_error('unable to create directory ' + compat_str(err))
self.report_error('unable to create directory ' + error_to_str(err))
return
if self.params.get('writedescription', False):
@@ -2039,4 +2040,4 @@ def _write_thumbnails(self, info_dict, filename):
(info_dict['extractor'], info_dict['id'], thumb_display_id, thumb_filename))
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
self.report_warning('Unable to download thumbnail "%s": %s' %
(t['url'], compat_str(err)))
(t['url'], error_to_str(err)))