Catching errors from a workflow like activity interceptors do

Hi, I have created an activity interceptor that implements ActivityInboundCallsInterceptor that allows me to catch errors from an activity and log them our Sentry instance. I have been trying to find something similar for long running workflows (client.start) but haven’t seen it in the documentation. I have only seen Interceptors that wrap execute and signal, but I would like to use interceptor that would be called if there’s ever an unexpected error from the workflow itself not the activity.
I am starting my workflows with client.start because it is long running and so I can’t use an execute interceptor.
Is there anything like that?
To get past this I have written a decorator that will achieve this but it is a little cumbersome and would prefer an interceptor-like solution if it can be achieved.

Thanks!

I think you want to implement a WorkfloInboundCallsInterceptor.

That worked for me thank you. I had tried that before but it wasn’t being called because I didn’t initialize it correctly in the worker options.

1 Like

Is there any interceptor for when the workflow completes either successfully or error?

The interceptor intercepts the whole workflow method invocation. So, it can add custom logic for workflow completion or failure.