From 1bbe7702d3c7cfca35595b8672f3a0e8450eb630 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 14 May 2020 17:08:04 +0200 Subject: [PATCH] Actually show better errors --- commands/fun/ytp.js | 4 ++-- commands/utility/download.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js index 0ce78c01..7f9372ac 100644 --- a/commands/fun/ytp.js +++ b/commands/fun/ytp.js @@ -135,9 +135,9 @@ class ytpCommand extends Command { return youtubedl.exec(url, ['--rm-cache-dir', '--no-playlist', '--max-filesize', '50m', '--format=mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, async function(err, output) { console.log(output); if (err) { - console.error(err); + console.error(err.toString()); loadingmsg.delete(); - if (err.includes('HTTP Error 429')) { + if (err.toString().includes('HTTP Error 429')) { return message.channel.send('An error has occured, I can\'t download from the link you provided because the website has blocked the bot. Please try again later or upload that video as mp4 on another website.'); } else { return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?'); diff --git a/commands/utility/download.js b/commands/utility/download.js index 2e962b86..7dce8b61 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -74,9 +74,9 @@ class DownloadCommand extends Command { } return youtubedl.exec(link, ['--rm-cache-dir', '-o', `${os.tmpdir()}/${fileName}`], {}, async function(err) { if (err) { - console.error(err); + console.error(err.toString()); loadingmsg.delete(); - if (err.includes('HTTP Error 429')) { + if (err.toString().includes('HTTP Error 429')) { return message.channel.send('An error has occured, I can\'t download from the link you provided because the website has blocked the bot. Please try again later.'); } else { return message.channel.send('An error has occured, I can\'t download from the link you provided.');