coinbase / temporal-ruby

Ruby SDK for Temporal
Apache License 2.0
238 stars 89 forks source link

How to fail workflow from the activity? #253

Open arrowcircle opened 1 year ago

arrowcircle commented 1 year ago

Hey! I am looking for a way to fail workflow from the activity. I found termiation example, but this sets workflow status to terminated, not to failed.

Is there are any way to fail workflow from the activity?

santiagodoldan commented 1 year ago

Not sure if you were looking for an API to fail a workflow, I'm not sure if there is one really, but if you raise a custom error and you add it to the non_retriable_errors collection of the retry_policy config, that should work.

arrowcircle commented 1 year ago

@santiagodoldan Thanks for the suggestions. In this case, it will show workflow as terminated (grey), not failed (red). This breaks visibility in UX a lot.

cdimitroulas commented 6 months ago

@santiagodoldan Thanks for the suggestions. In this case, it will show workflow as terminated (grey), not failed (red). This breaks visibility in UX a lot.

I don't think this is true. Raising a non-retriable error will fail the activity and the workflow correctly (failed, not terminated). We have been using this successfully in our app.