Add additional logging to automations

This commit is contained in:
Rory Powell 2022-03-30 14:26:51 +01:00
parent 6eabe4da1f
commit 5da441cf55
1 changed files with 5 additions and 1 deletions

View File

@ -17,10 +17,14 @@ const Runner = new Thread(ThreadType.AUTOMATION)
exports.processEvent = async job => { exports.processEvent = async job => {
try { try {
// need to actually await these so that an error can be captured properly // need to actually await these so that an error can be captured properly
console.log(
`${job.data.automation.appId} automation ${job.data.automation._id} running`
)
return await Runner.run(job) return await Runner.run(job)
} catch (err) { } catch (err) {
const errJson = JSON.stringify(err)
console.error( console.error(
`${job.data.automation.appId} automation ${job.data.automation._id} was unable to run - ${err}` `${job.data.automation.appId} automation ${job.data.automation._id} was unable to run - ${errJson}`
) )
console.trace(err) console.trace(err)
return { err } return { err }