Workflow retry "ContinueAsNew"

Hi guys, i have a question about NonRetryableErrorReasons:
I have an “full.qualified.name.packages.NameOfException” that is eventually thrown by an activity and both Activity and Workflow should not do Retry.
So i have set .setDoNotRetry(“full.qualified.name.packages.NameOfException”) 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 “full.qualified.name.packages.NameOfException” 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.