Better 413 error handling in cli script

This commit is contained in:
Chocobozzz 2022-01-18 09:19:59 +01:00
parent 4dfd57ae6f
commit 743dab5517
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 1 deletions

View File

@ -63,7 +63,13 @@ async function run (url: string, username: string, password: string) {
console.log(`Video ${options.videoName} uploaded.`)
process.exit(0)
} catch (err) {
console.error(require('util').inspect(err))
const message = err.message || ''
if (message.includes('413')) {
console.error('Aborted: the video file you try to upload it too big for this PeerTube instance.')
} else {
console.error(require('util').inspect(err))
}
process.exit(-1)
}
}