aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-03-08 12:04:49 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-03-08 12:04:49 +0530
commit497d2fab6c25df04362e5fac8383acd28030a97b (patch)
tree214807d07d26a75dc66ef7671225d79020e494fe
parent2807d1709bb5b0d79d210145cb213242b2dbf41a (diff)
downloadhypervideo-pre-497d2fab6c25df04362e5fac8383acd28030a97b.tar.lz
hypervideo-pre-497d2fab6c25df04362e5fac8383acd28030a97b.tar.xz
hypervideo-pre-497d2fab6c25df04362e5fac8383acd28030a97b.zip
[utils] Better traceback for `ExtractorError`
-rw-r--r--yt_dlp/extractor/common.py2
-rw-r--r--yt_dlp/utils.py7
2 files changed, 5 insertions, 4 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index f86e7cb3e..5b7de1296 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -749,7 +749,7 @@ class InfoExtractor(object):
errmsg = '%s: %s' % (errnote, error_to_compat_str(err))
if fatal:
- raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
+ raise ExtractorError(errmsg, cause=err)
else:
self.report_warning(errmsg)
return False
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 8256d543e..9406eb834 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -1076,9 +1076,10 @@ class ExtractorError(YoutubeDLError):
'' if expected else bug_reports_message())))
def format_traceback(self):
- if self.traceback is None:
- return None
- return ''.join(traceback.format_tb(self.traceback))
+ return join_nonempty(
+ self.traceback and ''.join(traceback.format_tb(self.traceback)),
+ self.cause and ''.join(traceback.format_exception(self.cause)[1:]),
+ delim='\n') or None
class UnsupportedError(ExtractorError):