handle some error better idk

This commit is contained in:
supositware 2021-05-18 20:23:11 +02:00
parent 498ceec658
commit d2566ba184
2 changed files with 7 additions and 3 deletions

View file

@ -142,6 +142,7 @@ router.post('/', async function(req, res, next) {
video.on('error', function(err) {
console.error(err);
progress[data.uuid] = 0;
res.json({ error: err.stderr});
});

View file

@ -224,11 +224,12 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
CheckProgress();
}, 1000);
// Définissez ce qui se passe si la soumission s'est opérée avec succès
xhttp.addEventListener("load", function(event) {
const json = JSON.parse(event.target.responseText);
console.log(json);
if (json.error) {
clearInterval(progress);
document.getElementById('progress').innerHTML = '';
alert(json.error);
} else {
const url = json.url;
@ -250,7 +251,6 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
}, 500)
});
// Definissez ce qui se passe en cas d'erreur
xhttp.addEventListener("error", function(event) {
clearInterval(progress);
document.getElementById('progress').innerHTML = '';
@ -272,6 +272,9 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
});
xhttp.addEventListener("error", function(event) {
clearInterval(progress);
document.getElementById('progress').innerHTML = '';
alert('whoops, something gone wrong');
console.error(event.target.responseText);
});
}