@wmfs/tymly-cardscript-plugin
Version:
Plugin which handles interactions to do with Cardscript
24 lines (22 loc) • 675 B
JavaScript
module.exports = function stopExecution () {
return async function (event, env, context) {
const logger = env.bootedServices.logger.child('function:stopExecution')
const { userId } = context
const { statebox } = env.bootedServices
const { executionName } = event
try {
await statebox.stopExecution(
'Execution stopped externally',
'STOPPED',
executionName,
{
userId,
action: 'stopExecution',
stateMachineName: executionName
}
)
} catch (err) {
logger.error(`Execution returned an error while attempting to stop (executionName='${executionName})'`)
}
}
}