properly send the error
This commit is contained in:
parent
b072cda0d6
commit
c9d0ffa50a
1 changed files with 8 additions and 7 deletions
|
@ -110,14 +110,15 @@ class DownloadController {
|
||||||
|
|
||||||
return youtubedl.exec(data.url, ['--format=mp4', '-o', altFolder], {}, function(err, output) {
|
return youtubedl.exec(data.url, ['--format=mp4', '-o', altFolder], {}, function(err, output) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return view.render(page, {
|
console.error(err);
|
||||||
|
return response.send(view.render(page, {
|
||||||
title: title,
|
title: title,
|
||||||
viewCounter: viewCounter,
|
viewCounter: viewCounter,
|
||||||
file: files,
|
file: files,
|
||||||
day: day, month: month, announcement: announcement ,
|
day: day, month: month, announcement: announcement ,
|
||||||
error: true,
|
error: true,
|
||||||
errormsg: 'bruh moment, you didin\'t input a valid link.'
|
errormsg: err
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.attachment(altFolder);
|
return response.attachment(altFolder);
|
||||||
|
@ -127,15 +128,15 @@ class DownloadController {
|
||||||
let video = youtubedl(data.url, ['--format=mp4', '-f', option]);
|
let video = youtubedl(data.url, ['--format=mp4', '-f', option]);
|
||||||
|
|
||||||
video.on('error', function(err) {
|
video.on('error', function(err) {
|
||||||
//console.error(err);
|
console.error(err);
|
||||||
return view.render(page, {
|
return response.send(view.render(page, {
|
||||||
title: title,
|
title: title,
|
||||||
viewCounter: viewCounter,
|
viewCounter: viewCounter,
|
||||||
file: files,
|
file: files,
|
||||||
day: day, month: month, announcement: announcement ,
|
day: day, month: month, announcement: announcement ,
|
||||||
error: true,
|
error: true,
|
||||||
errormsg: 'bruh moment, you didin\'t input a valid link.'
|
errormsg: err
|
||||||
});
|
}));
|
||||||
})
|
})
|
||||||
|
|
||||||
let ext;
|
let ext;
|
||||||
|
|
Loading…
Reference in a new issue