Handling "expected" failures w/o failing workflow?

We’ve integrated temporal with our web app such that it’s used to process some long-running api requests and report their progress back to the app when done. I’d like to give developers a way to handle “bad user input” such that:

  • it won’t fail the workflow (workflow failures are something we monitor for operational reasons and have found it a helpful way to discover bugs in our workflows/activities, i’d like these “bad user input” / validation errors not to create noise, since they’d be “expected” error conditions, similar to how HTTP 4XX would typically be ignored but HTTP 5XX would not)
  • but i can still hook into it from an interceptor (i’d like to execute some logic that marks the corresponding job in our app as “failed input validation”, with the appropriate user-facing error message)
  • Dev ideally could signal this from the workflow or an activity

I’d been trying to just throw a custom exception and catch that in an interceptor, but that causes the workflow to be marked as a failure.

The only other way I can think of to do this involves returning special validation failure indicators and tedious checking of the return value from every activity call.

Hopefully I’m missing something obvious and you all have some suggestions here! Appreciate it.

Have you considered using updateWithStart to start a workflow? This way, a bad update input will fail the update, not the workflow.

In some of these workflows, we can’t fully validate input until we do some processing in activities (example: customer submits a CSV with items to import, some values in the CSV have to be validated, so the file has to be downloaded and inspected, then we either proceed or mark the input as invalid).

UpdateWithStart supports blocking update until you run the validation activities.