Interface AttemptContributing
interface AttemptContributing {
willContribute<T>(
key: string,
value: T & AsValue<T>,
): AttemptContributing;
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmitting;
willFail(reason: string | Reason): StepScript;
willSetGlobalMetadata<T>(
key: string,
value: T & AsValue<T>,
): AttemptSettingGlobalMetadata;
willSkip(): StepScript;
willSkipBecause(reason: string | Reason): StepScript;
willSucceed(): StepScript;
willTerminateAbnormally(errorMessage: string): StepScript;
}
willContribute<T>(
key: string,
value: T & AsValue<T>,
): AttemptContributing;
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmitting;
willFail(reason: string | Reason): StepScript;
willSetGlobalMetadata<T>(
key: string,
value: T & AsValue<T>,
): AttemptSettingGlobalMetadata;
willSkip(): StepScript;
willSkipBecause(reason: string | Reason): StepScript;
willSucceed(): StepScript;
willTerminateAbnormally(errorMessage: string): StepScript;
}
Hierarchy (View Summary)
- AttemptEmitting
- AttemptContributing
Methods
will Contribute
-
The attempts contribute
valueunderkey, committed only when an attempt succeeds, as a step's contributions are.Type Parameters
- T
Returns AttemptContributing
will Emit
-
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmittingThe attempts emit an event at
level, withmessageand, if given,data, as the step's reporter would.Type Parameters
- T = undefined
Returns AttemptEmitting
will Fail
-
The attempts fail, for
reason, or a reason with only this code.Parameters
- reason: string | Reason
Returns StepScript
will Set Global Metadata
-
The attempts set the global metadata
keytovalue, as the step's reporter would.Type Parameters
- T
Returns AttemptSettingGlobalMetadata
will Skip
-
The step skips itself, giving no reason.
Returns StepScript
will Skip Because
-
The step skips itself, for
reason, or a reason with only this code.Parameters
- reason: string | Reason
Returns StepScript
will Succeed
-
The attempts succeed.
Returns StepScript
will Terminate Abnormally
-
The attempts terminate abnormally, with an error carrying
errorMessage.Parameters
- errorMessage: string
Returns StepScript
The attempts chosen contribute, then go on as AttemptEmitting.