From 2e159cf7c4c1babce7b2378d1bbd1992bbef4eaf Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 20 May 2017 13:44:15 -0500 Subject: [PATCH] Catch the other, not so common ExtractionError --- cogs/music.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cogs/music.py b/cogs/music.py index b0bbc6f..c43fbac 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -364,12 +364,17 @@ class Music: except WrongEntryTypeError: await ctx.send("Cannot enqueue playlists at this time.") except ExtractionError as e: - # The first entry is the "We couldn't download" printed by the exception - # The 2nd is the new line - # We want youtube_dl's error message, but just the first part, the actual "error" - error = e.message.split('\n')[2] - # This is colour formatting for the console...it's just going to show up as text on discord - error = error.strip("ERROR: ") + error = e.message.split('\n') + if len(error) >= 3: + # The first entry is the "We couldn't download" printed by the exception + # The 2nd is the new line + # We want youtube_dl's error message, but just the first part, the actual "error" + error = error[2] + # This is colour formatting for the console...it's just going to show up as text on discord + error = error.strip("ERROR: ") + else: + # This happens when the download just returns `None` + error = error[0] await ctx.send(error) else: try: