1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 12:25:03 -04:00

[cleanup] Minor improvements to error and debug messages

This commit is contained in:
pukkandan
2021-11-10 04:19:33 +05:30
parent d54c6003ab
commit aa9369a2d8
5 changed files with 98 additions and 39 deletions

View File

@@ -795,15 +795,15 @@ def main(argv=None):
_real_main(argv)
except DownloadError:
sys.exit(1)
except SameFileError:
sys.exit('ERROR: fixed output name but more than one file to download')
except SameFileError as e:
sys.exit(f'ERROR: {e}')
except KeyboardInterrupt:
sys.exit('\nERROR: Interrupted by user')
except BrokenPipeError:
except BrokenPipeError as e:
# https://docs.python.org/3/library/signal.html#note-on-sigpipe
devnull = os.open(os.devnull, os.O_WRONLY)
os.dup2(devnull, sys.stdout.fileno())
sys.exit(r'\nERROR: {err}')
sys.exit(f'\nERROR: {e}')
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']