catch fail file download
This commit is contained in:
1 file changed
+5
@@ -16,6 +16,11 @@ module.exports = {
|
|||||||
).then(res => res);
|
).then(res => res);
|
||||||
|
|
||||||
const stream = fs.createWriteStream(outputDir);
|
const stream = fs.createWriteStream(outputDir);
|
||||||
|
if (!res.data.token) {
|
||||||
|
client.error(`Error downloading File "${filename}":`);
|
||||||
|
client.error(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { body } = await fetch(res.data.token.url);
|
const { body } = await fetch(res.data.token.url);
|
||||||
await finished(Readable.fromWeb(body).pipe(stream));
|
await finished(Readable.fromWeb(body).pipe(stream));
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user