[jsinterp] Truncate error messages

Related: #4635
This commit is contained in:
pukkandan 2022-08-12 18:53:53 +05:30
parent 5da42f2b9b
commit a1c5bd82ec
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
2 changed files with 26 additions and 15 deletions

View file

@ -5759,6 +5759,13 @@ def make_archive_id(ie, video_id):
return f'{ie_key.lower()} {video_id}'
def truncate_string(s, left, right=0):
assert left > 3 and right >= 0
if s is None or len(s) <= left + right:
return s
return f'{s[:left-3]}...{s[-right:]}'
# Deprecated
has_certifi = bool(certifi)
has_websockets = bool(websockets)