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)) const existingVariable = variables.find(byId(varMapping.variableId))
if (!existingVariable) return newVariables if (!existingVariable) return newVariables
const func = Function('data', `return data.${varMapping?.bodyPath}`) const func = Function('data', `return data.${varMapping?.bodyPath}`)
const value = func(data) try {
updateVariableValue(existingVariable?.id, value) const value = func(data)
return [...newVariables, { ...existingVariable, value }] updateVariableValue(existingVariable?.id, value)
return [...newVariables, { ...existingVariable, value }]
} catch (err) {
return newVariables
}
}, []) }, [])
updateVariables(newVariables) updateVariables(newVariables)
return step.outgoingEdgeId return step.outgoingEdgeId