Skip to main content

Function: NonRetryable()

NonRetryable(optionsOrErrors?): MethodDecorator & ClassDecorator

Defined in: src/error-mapping/non-retryable.decorator.ts:24

Mark an activity (a method, or every method of a class) so that errors it throws fail the activity without retries. Takes effect only when the errorMapping module option is on.

@Activity()
export class PaymentActivities {
@ActivityMethod()
@NonRetryable([InvalidCardError]) // only these errors are final
async charge(order: Order) { ... }

@ActivityMethod()
@NonRetryable() // any error is final
async validate(order: Order) { ... }
}

Metadata is written with Reflect.defineMetadata, on the constructor and prototype for a class and on the prototype for a method, like the other decorators in this library.

Parameters​

optionsOrErrors?​

NonRetryableOptions | ErrorClass[]

Returns​

MethodDecorator & ClassDecorator