mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-12-13 21:22:31 +00:00
🧑💻 Improve record error debugging
This commit is contained in:
parent
e6a2962ef1
commit
70c608b9a7
2 changed files with 13 additions and 11 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue