Actually show better errors

This commit is contained in:
loicbersier 2020-05-14 17:08:04 +02:00
parent 18193e1b78
commit 1bbe7702d3
2 changed files with 4 additions and 4 deletions

View file

@ -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?');

View file

@ -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.');