2
0

fix(engine): 🐛 Wrap webhook evalution in try catch

This commit is contained in:
Baptiste Arnaud
2022-04-05 10:05:34 +02:00
parent 1fdf7e734b
commit eb5a5d9a15

View File

@ -248,9 +248,13 @@ const executeWebhook = async (
const existingVariable = variables.find(byId(varMapping.variableId))
if (!existingVariable) return newVariables
const func = Function('data', `return data.${varMapping?.bodyPath}`)
const value = func(data)
updateVariableValue(existingVariable?.id, value)
return [...newVariables, { ...existingVariable, value }]
try {
const value = func(data)
updateVariableValue(existingVariable?.id, value)
return [...newVariables, { ...existingVariable, value }]
} catch (err) {
return newVariables
}
}, [])
updateVariables(newVariables)
return step.outgoingEdgeId