Is it possible to call $end from a component action to terminate the step?

This topic was automatically generated from Slack. You can find the original thread here.

Nghia Nguyen : with the new actions components, is it possible to call $end somehow to terminate the step?

Dylan Sather (Pipedream) : We’re still speccing out support for $end in component actions, but for now, if you want to end the execution of just the step, you can return, and we’ll move to the next step. If you want to end the execution of the whole workflow, you can throw any error and we’ll terminate execution:

throw new Error("custom message here")

Nghia Nguyen : got it, thanks Dylan!

Dylan Sather (Pipedream) : np!

Dylan Sather (Pipedream) : I believe Giao may have already mentioned this to you, but the final syntax for this (now supported in component actions) is:

async run({ $ }) {
  return $.flow.exit("reason")