diff --git a/record/record.js b/record/record.js index bc3e35f..2d4ac48 100644 --- a/record/record.js +++ b/record/record.js @@ -36,7 +36,6 @@ module.exports = async (files) => { ) } catch (error) { if (error.code === 'RECORDER_TIMEOUT') { - console.error(error.message) console.info('The recorder timed out.') console.info( "You probably need to activate the screen recording feature for the terminal you're using." @@ -45,11 +44,12 @@ module.exports = async (files) => { "You'll find that settings under: System Parameters > Security & Confidentiality > Confidentiality > Screen recording" ) } else if (error.code === 'ENOTDIR') { - console.error(error.message) console.info('A mandatory folder was not found.') } else { - console.error('An error occured while recording', error) + console.error('An error occured while recording') } + + throw error } } diff --git a/record/utils.js b/record/utils.js index 6b87e89..a52dfc2 100644 --- a/record/utils.js +++ b/record/utils.js @@ -87,6 +87,7 @@ function resizeVideo(input, output) { console.info(' Resizing video') return new Promise((resolve, reject) => { + const ffmpegRawLogs = [] const ffmpeg = spawn('ffmpeg', [ '-i', input, @@ -104,15 +105,16 @@ function resizeVideo(input, output) { output, ]) - if (process.env.NODE_ENV === 'DEBUG') { - ffmpeg.stderr.on('data', function (message) { - console.debug(`${message}`) - }) - } - + ffmpeg.stderr.on('data', (message) => + ffmpegRawLogs.push(message.toString('utf8')) + ) ffmpeg.on('exit', (ffmpegExitCode) => { - if (ffmpegExitCode === '1') { - return reject('ffmpeg') + if (process.env.NODE_ENV === 'DEBUG') { + console.debug(ffmpegRawLogs.join('\n')) + } + + if (ffmpegExitCode !== 0) { + return reject(ffmpegRawLogs.join('\n')) } resolve()