in src/task/RegisteredActivityTask.ts [11:31]
constructor(activityName: string, input?: unknown) {
super(false, new CallActivityAction(activityName, input));
this.withRetry = (retryOptions: RetryOptions): RetryableTask => {
if (this.alreadyScheduled) {
throw new Error(
"Invalid use of `.withRetry`: attempted to create a retriable task from an already scheduled task. " +
`A task with ID ${this.id} to call activity ${activityName} has already been scheduled. ` +
"Make sure to only invoke `.withRetry` on tasks that have not previously been yielded."
);
}
const callActivityWithRetryAction = new CallActivityWithRetryAction(
activityName,
retryOptions,
input
);
const backingTask = new AtomicTask(false, callActivityWithRetryAction);
return new RetryableTask(backingTask, retryOptions);
};
}