How to Make a Workflow Error When `$.flow.suspend` Times Out?

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

Is there any way to make a workflow error when $.flow.suspend times out?

Otherwise, the workflow just ends silently (but not successfully).

Yes, you can throw an error when the maximum number of retries is exceeded using $.flow.rerun. Here’s an example: export default defineComponent({ async run({ $ }) { const MAX_RETRIES = 3; const { run } = $.context; if (run.runs === 1) { $.flow.rerun(1000, null, MAX_RETRIES); } else if (run.runs === MAX_RETRIES + 1) { throw new Error("Max retries exceeded"); } }, }); In this example, the step will rerun up to MAX_RETRIES times. If the maximum number of retries is exceeded, it will throw an error with the message “Max retries exceeded”.

Ah, good idea!

Thank you ! :pray:

You’re welcome! If you have any more questions or need further assistance, feel free to ask. I’m here to help! :blush: