Application error handling

I was under the impression “NewNonRetryableApplicationError” means that a “NonRetryable” error has occurred so we should fail the workflow completely. Rather I see a new workflow started as “Continuedasnew”.

Given a workflow with activity A, B, C, D, E, F - any activity that returns a nonretryable error should cause the workflow to process the error and then hard fail.

Use case is with financial transactions;

makeFinancialTransactionWithThirdPartyActivity: = workflow.ExecuteActivity(ctx, a.FinancialTransactionActivity)
err = makeFinancialTransactionWithThirdPartyActivity.Get(ctx, & transaction)
if err != nil {
    cancelErr: = workflow.ExecuteActivity(ctx, a.RevertFinancialTransactionInternalActivity).Get(ctx, nil)
    if cancelErr != nil {
        return nil, cancelErr
    }

    return nil,
    err
}

When FinancialTransactionActivity returns a hard error we want to revert a transaction on our end with RevertFinancialTransactionInternalActivity.

Currently when “NewNonRetryableApplicationError” is returned the workflow is recreated.

What is the best way of handling real hard errors?

1 Like