My understanding as of right now:
We can call a “notifyUsersWorkflowStarted” activity as the first line in our workflow.
We can call a “notifyUsersWorkflowSucceded” activity as the last line in our workflow.
Uncertain:
We can wrap the whole workflow in a try catch block and call a “notifyUsersWorkflowErrored” activity in the catch (and rethrow the exception).
Not possible:
There’s no way to notify the user if a workflow fails due to a worker crashing.
There are interceptors that run on the worker that can intercept the API request telling the temporal server that the state of a workflow has changed, this would cover all bases except a worker crashing.
Uncertain:
We can wrap the whole workflow in a try catch block and call a “notifyUsersWorkflowErrored” activity in the catch (and rethrow the exception).
Yes, you can absolutely put this logic in catch or even in finally block.
Not possible:
There’s no way to notify the user if a workflow fails due to a worker crashing.
This is because workflows don’t fail when workers crash. They just keep running at another worker as if nothing happened . This is the main value proposition of Temporal.