Replacing the err being thrown by a gracefull exit.process(1)

pull/415/head
Okhin 2018-03-24 20:11:37 +01:00 committed by Rigel Kent
parent b32b782718
commit f5b611f9ee
1 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,10 @@ async function run () {
const options = [ '-j', '--flat-playlist', '--playlist-reverse' ] const options = [ '-j', '--flat-playlist', '--playlist-reverse' ]
youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => { youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => {
if (err) throw err if (err) {
console.log(err.message);
process.exit(1);
}
let infoArray: any[] let infoArray: any[]
@ -157,7 +160,8 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag
await uploadVideo(program['url'], accessToken, videoAttributes) await uploadVideo(program['url'], accessToken, videoAttributes)
} else { } else {
throw err console.log(err.message);
process.exit(1);
} }
} }