Catch error in import script

This commit is contained in:
Chocobozzz 2020-04-14 09:41:20 +02:00
parent a388781916
commit f940e81469
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 6 deletions

View File

@ -93,12 +93,16 @@ async function run (url: string, user: UserInfo) {
log.info('Will download and upload %d videos.\n', infoArray.length) log.info('Will download and upload %d videos.\n', infoArray.length)
for (const info of infoArray) { for (const info of infoArray) {
try {
await processVideo({ await processVideo({
cwd: program['tmpdir'], cwd: program['tmpdir'],
url, url,
user, user,
youtubeInfo: info youtubeInfo: info
}) })
} catch (err) {
console.error('Cannot process video.', { info, url })
}
} }
log.info('Video/s for user %s imported: %s', user.username, program['targetUrl']) log.info('Video/s for user %s imported: %s', user.username, program['targetUrl'])