Workflow retry "ContinueAsNew"

Hi guys, i have a question about NonRetryableErrorReasons:
I have an “” that is eventually thrown by an activity and both Activity and Workflow should not do Retry.
So i have set .setDoNotRetry(“”) in the activity AND in the Workflow.
In the activity it works fine and it doesn’t do the retries, but the Workflow create a new workflow execution “ContinueAsNew” how is possibile to avoid that?
Could be because to the workflow the error is “io.temporal.failure.ApplicationFailure” and not “” that is instead set as Type? How can i do this?

The reason the workflow didn’t retry because an activity failure is always wrapped in the ActivityFailure exception. As ActivityFailure by default is always retryable the workflow is not retried.

The solution is to throw an ApplicationFailure (possibly created with ApplicationFailure.newNonRetryableFailure) that wraps the ActivityFailure.