From d2ce8049de7c0f34ee0e438ca0500d5e7c09ff9e Mon Sep 17 00:00:00 2001
From: Loic Bersier <loic.bersier1@gmail.com>
Date: Tue, 20 Nov 2018 19:47:54 +0100
Subject: [PATCH] handle error

---
 commands/utility/download.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands/utility/download.js b/commands/utility/download.js
index d9d915c6..2e1e6017 100644
--- a/commands/utility/download.js
+++ b/commands/utility/download.js
@@ -33,10 +33,14 @@ module.exports = class downloadCommand extends Command {
               })
             let video = youtubedl(link, [`--username=${fbuser}`,`--password=${fbpasswd}`])
             video.pipe(fs.createWriteStream('video.mp4'))
+            video.on('error', function error(err) {
+                console.log('error 2:', err);
+                message.say("An error has occured, i can't download from the link you provided.")
+              });
             video.on('end', function() {
                 message.delete();
                 message.channel.send(`Downloaded by ${message.author.username}`, {files: ["./video.mp4"]})
-                .catch(error => message.say('An error has occured, the file might be too big or i cant download the link you provided'))
+                .catch(error => message.say('File too big'))
             })
         } else 
             message.say("You need to input a valid link")