Existing documentation URL(s)
https://developers.cloudflare.com/workflows/build/sleeping-and-retrying/#catch-workflow-errors
What changes are you suggesting?
Hey 👋,
On the page "Sleeping and retrying", section "Catch Workflow Errors", there is something weird in the given example:
try {
await step.do('non-retryable-task', async () => {
// work not to be retried
throw new NonRetryableError('oh no');
});
} catch (e) {
console.log(`Step failed: ${e.message}`);
await step.do('clean-up-task', async () => {
// Clean up code here
});
}
Yes, this example works, but what happens if, instead of the NonRetryableError, a simple Error was thrown (like with a fetch)? The step clean-up-task is executed, and the workflow continues, but maybe I want to retry the workflow, so I re-throw the error. When the workflow will retry, and if it fails again, will the step clean-up-task run again?
Also, this is really weird to not have access to the number of retries of a step or a workflow (through the do callback for a step and event for the workflow).
Additional information
No response
Existing documentation URL(s)
https://developers.cloudflare.com/workflows/build/sleeping-and-retrying/#catch-workflow-errors
What changes are you suggesting?
Hey 👋,
On the page "Sleeping and retrying", section "Catch Workflow Errors", there is something weird in the given example:
Yes, this example works, but what happens if, instead of the
NonRetryableError, a simpleErrorwas thrown (like with a fetch)? The stepclean-up-taskis executed, and the workflow continues, but maybe I want to retry the workflow, so I re-throw the error. When the workflow will retry, and if it fails again, will the stepclean-up-taskrun again?Also, this is really weird to not have access to the number of retries of a step or a workflow (through the
docallback for a step and event for the workflow).Additional information
No response