makeFriends(hosts)
.then(() => logger.info('Made friends!'))
- .catch(err => logger.error('Could not make friends.', { error: err }))
+ .catch(err => logger.error('Could not make friends.', err))
// Don't wait the process that could be long
res.type('json').status(204).end()
return fun.call(this, data, fromPod)
})
- .catch(err => logger.error('Error managing remote videos.', { error: err }))
+ .catch(err => logger.error('Error managing remote videos.', err))
// Don't block the other pod
return res.type('json').status(204).end()
return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod)
})
- .catch(err => logger.error('Error managing remote videos.', { error: err }))
+ .catch(err => logger.error('Error managing remote videos.', err))
return res.type('json').status(204).end()
}
return processVideosEventsRetryWrapper(eventData, fromPod)
})
- .catch(err => logger.error('Error managing remote videos.', { error: err }))
+ .catch(err => logger.error('Error managing remote videos.', err))
return res.type('json').status(204).end()
}
})
.then(() => logger.info('Remote video event processed for video %s.', eventData.remoteId))
.catch(err => {
- logger.debug('Cannot process a video event.', { error: err })
+ logger.debug('Cannot process a video event.', err)
throw err
})
}
})
})
.then(() => logger.info('Remote video %s quick and dirty updated', videoName))
- .catch(err => logger.debug('Cannot quick and dirty update the remote video.', { error: err }))
+ .catch(err => logger.debug('Cannot quick and dirty update the remote video.', err))
}
// Handle retries on fail
})
.then(() => logger.info('Remote video %s inserted.', videoToCreateData.name))
.catch(err => {
- logger.debug('Cannot insert the remote video.', { error: err })
+ logger.debug('Cannot insert the remote video.', err)
throw err
})
}
.then(() => logger.info('Remote video %s updated', videoAttributesToUpdate.name))
.catch(err => {
// This is just a debug because we will retry the insert
- logger.debug('Cannot update the remote video.', { error: err })
+ logger.debug('Cannot update the remote video.', err)
throw err
})
}
return video.destroy()
})
.catch(err => {
- logger.debug('Could not fetch remote video.', { host: fromPod.host, remoteId: videoToRemoveData.remoteId, error: err })
+ logger.debug('Could not fetch remote video.', { host: fromPod.host, remoteId: videoToRemoveData.remoteId, error: err.stack })
})
}
return db.VideoAbuse.create(videoAbuseData)
})
- .catch(err => logger.error('Cannot create remote abuse video.', { error: err }))
+ .catch(err => logger.error('Cannot create remote abuse video.', err))
}
function fetchOwnedVideo (id: string) {
return video
})
.catch(err => {
- logger.error('Cannot load owned video from id.', { error: err, id })
+ logger.error('Cannot load owned video from id.', { error: err.stack, id })
throw err
})
}
return video
})
.catch(err => {
- logger.error('Cannot load video from host and remote id.', { error: err, podHost, remoteId })
+ logger.error('Cannot load video from host and remote id.', { error: err.stack, podHost, remoteId })
throw err
})
}
.then(user => user.destroy())
.then(() => res.sendStatus(204))
.catch(err => {
- logger.error('Errors when removed the user.', { error: err })
+ logger.error('Errors when removed the user.', err)
return next(err)
})
}
})
.then((videoInstance: VideoInstance) => logger.info('Abuse report for video %s created.', videoInstance.name))
.catch(err => {
- logger.debug('Cannot update the video.', { error: err })
+ logger.debug('Cannot update the video.', err)
throw err
})
}
db.BlacklistedVideo.create(toCreate)
.then(() => res.type('json').status(204).end())
.catch(err => {
- logger.error('Errors when blacklisting video ', { error: err })
+ logger.error('Errors when blacklisting video ', err)
return next(err)
})
}
cb(null, filename + '.' + extension)
})
.catch(err => {
- logger.error('Cannot generate random string for file name.', { error: err })
+ logger.error('Cannot generate random string for file name.', err)
throw err
})
}
logger.info('Video with name %s updated.', videoInstance.name)
})
.catch(err => {
- logger.debug('Cannot update the video.', { error: err })
+ logger.debug('Cannot update the video.', err)
// Force fields we want to update
// If the transaction is retried, sequelize will think the object has not changed
}
return quickAndDirtyUpdateVideoToFriends(qaduParams)
})
- .catch(err => logger.error('Cannot add view to video %d.', videoInstance.id, { error: err }))
+ .catch(err => logger.error('Cannot add view to video %d.', videoInstance.id, err))
} else {
// Just send the event to our friends
const eventParams = {
videoInstance.destroy()
.then(() => res.type('json').status(204).end())
.catch(err => {
- logger.error('Errors when removed the video.', { error: err })
+ logger.error('Errors when removed the video.', err)
return next(err)
})
}
.then(() => logger.info('User video rate for video %s of user %s updated.', videoInstance.name, userInstance.username))
.catch(err => {
// This is just a debug because we will retry the insert
- logger.debug('Cannot add the user video rate.', { error: err })
+ logger.debug('Cannot add the user video rate.', err)
throw err
})
}
)
.catch(err => {
// Do not throw the error, continue the process
- logger.error(options.errorMessage, { error: err })
+ logger.error(options.errorMessage, err)
})
}
try {
dataString = JSON.stringify(data)
} catch (err) {
- logger.error('Cannot check signature.', { error: err })
+ logger.error('Cannot check signature.', err)
return false
}
}
try {
dataString = JSON.stringify(data)
} catch (err) {
- logger.error('Cannot sign data.', { error: err })
+ logger.error('Cannot sign data.', err)
return Promise.resolve('')
}
}
}, { concurrency: REQUESTS_IN_PARALLEL })
.then(() => pods)
.catch(err => {
- logger.error('Some errors while quitting friends.', { err: err })
+ logger.error('Some errors while quitting friends.', err)
// Don't stop the process
})
})
return createRequest(options)
})
.catch(err => {
- logger.error('Cannot convert video to remote.', { error: err })
+ logger.error('Cannot convert video to remote.', err)
// Don't break the process
return undefined
})
sendOwnedVideosToPod(podCreated.id)
})
.catch(err => {
- logger.error('Cannot add friend %s pod.', pod.host, { error: err })
+ logger.error('Cannot add friend %s pod.', pod.host, err)
})
} else {
logger.error('Status not 200 for %s pod.', pod.host)
}
function onError (err: Error, jobId: number) {
- logger.error('Error when transcoding video file in job %d.', jobId, { error: err })
+ logger.error('Error when transcoding video file in job %d.', jobId, err)
return Promise.resolve()
}
// Optimization: we could use "drain" from queue object
return setTimeout(next, JOBS_FETCHING_INTERVAL)
})
- .catch(err => logger.error('Cannot list pending jobs.', { error: err }))
+ .catch(err => logger.error('Cannot list pending jobs.', err))
},
- err => logger.error('Error in job scheduler queue.', { error: err })
+ err => logger.error('Error in job scheduler queue.', err)
)
})
- .catch(err => logger.error('Cannot list pending jobs.', { error: err }))
+ .catch(err => logger.error('Cannot list pending jobs.', err))
}
createJob (transaction: Sequelize.Transaction, handlerName: string, handlerInputData: object) {
},
err => {
- logger.error('Error in job handler %s.', job.handlerName, { error: err })
+ logger.error('Error in job handler %s.', job.handlerName, err)
return this.onJobError(jobHandler, job, err)
}
)
}
private cannotSaveJobError (err: Error) {
- logger.error('Cannot save new job state.', { error: err })
+ logger.error('Cannot save new job state.', err)
}
}
}
})
.catch(err => {
- logger.error('Error sending secure request to %s pod.', toPod.host, { error: err })
+ logger.error('Error sending secure request to %s pod.', toPod.host, err)
throw err
})
})
.catch(err => {
badPods.push(requestToMake.toPod.id)
- logger.info('Cannot make request to %s.', toPod.host, { error: err })
+ logger.info('Cannot make request to %s.', toPod.host, err)
})
}, { concurrency: REQUESTS_IN_PARALLEL }).then(() => ({ goodPods, badPods }))
})
afterRequestsHook () {
// Flush requests with no pod
this.getRequestModel().removeWithEmptyTo()
- .catch(err => logger.error('Error when removing requests with no pods.', { error: err }))
+ .catch(err => logger.error('Error when removing requests with no pods.', err))
}
}
function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) {
oAuthServer.authenticate()(req, res, function (err) {
if (err) {
- logger.error('Cannot authenticate.', { error: err })
+ logger.error('Cannot authenticate.', err)
return res.sendStatus(500)
}
return next()
})
.catch(err => {
- logger.error('Cannot know if we have friends.', { error: err })
+ logger.error('Cannot know if we have friends.', err)
res.sendStatus(500)
})
})
return next()
})
.catch(err => {
- logger.error('Cannot load pod by host.', { error: err })
+ logger.error('Cannot load pod by host.', err)
res.sendStatus(500)
})
})
next()
})
.catch(err => {
- logger.error('Error in usersAdd request validator.', { error: err })
+ logger.error('Error in usersAdd request validator.', err)
return res.sendStatus(500)
})
})
next()
})
.catch(err => {
- logger.error('Error in usersRemove request validator.', { error: err })
+ logger.error('Error in usersRemove request validator.', err)
return res.sendStatus(500)
})
})
next()
})
.catch(err => {
- logger.error('Error in user request validator.', { error: err })
+ logger.error('Error in user request validator.', err)
return res.sendStatus(500)
})
})
next()
})
.catch(err => {
- logger.error('Error in getting duration from file.', { error: err })
+ logger.error('Error in getting duration from file.', err)
res.status(400).send('Cannot retrieve metadata of the file.')
})
})
callback()
})
.catch(err => {
- logger.error('Error in video request validator.', { error: err })
+ logger.error('Error in video request validator.', err)
return res.sendStatus(500)
})
}
callback()
})
.catch(err => {
- logger.error('Error in video request validator.', { error: err })
+ logger.error('Error in video request validator.', err)
return res.sendStatus(500)
})
}
return tokenInfos
}).catch(function (err) {
- logger.info('getRefreshToken error.', { error: err })
+ logger.info('getRefreshToken error.', err)
})
}
if (goodPods.length !== 0) {
incrementScores(goodPods, PODS_SCORE.BONUS).catch(err => {
- logger.error('Cannot increment scores of good pods.', { error: err })
+ logger.error('Cannot increment scores of good pods.', err)
})
}
incrementScores(badPods, PODS_SCORE.MALUS)
.then(() => removeBadPods())
.catch(err => {
- if (err) logger.error('Cannot decrement scores of bad pods.', { error: err })
+ if (err) logger.error('Cannot decrement scores of bad pods.', err)
})
}
}
}
})
.catch(err => {
- logger.error('Cannot remove bad pods.', { error: err })
+ logger.error('Cannot remove bad pods.', err)
})
}
.catch(err => {
// Autodesctruction...
video.destroy().asCallback(function (err) {
- if (err) logger.error('Cannot destruct video after transcoding failure.', { error: err })
+ if (err) logger.error('Cannot destruct video after transcoding failure.', err)
})
return rej(err)