Function stepPolicy
-
stepPolicy(
options?: PolicyOptions,
): <C extends new () => StepPolicy>(
target: WithoutStaticData<C, typeof StepPolicy>,
) => voidParameters
- options: PolicyOptions = {}
Returns <C extends new () => StepPolicy>(
target: WithoutStaticData<C, typeof StepPolicy>,
) => voidThrows
Error, when the class is defined, if it does not extend
StepPolicyitself, if it keeps static data, if it is declared twice, if its name is empty, if it defines no hook, if a method carries requests but no hook, if a parameter of a hook has no request, or if a hook requests a cause it is not given: the failure cause outsideon step failure, or the retry cause outsideon step retry.
Declares a step policy: a class extending StepPolicy directly, whose hooks are its methods marked with the step hooks' decorators, such as
@onStepSuccess(). A step lists it in thepoliciesof its@withStep, which accepts only a class declared with@stepPolicy.A step policy keeps no static data, which every attempt of every journey would share, refused as WithoutStaticData says: at compile time, or else when the class is defined.