1
0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2024-11-22 07:37:29 +00:00

Remove "unknown download error" prefix

The reason for the error is known and is returned.
This commit is contained in:
Cadence Ember 2021-04-28 00:08:07 +12:00
parent 7737ea3ba5
commit e3595a455e
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -184,8 +184,13 @@ def extract_video(id):
"error": "Received unexpected status code {}.".format(e.exc_info[1].code) "error": "Received unexpected status code {}.".format(e.exc_info[1].code)
} }
else: else:
if e.exc_info and e.exc_info[1]:
message = str(e.exc_info[1])
message = message.replace("Video unavailable\n", "") # Remove redundant lead string, if present
else:
message = "Unknown extraction error."
result = { result = {
"error": "Unknown download error: {}".format(e.exc_info[1]) "error": message
} }
except Exception: except Exception: