wrapTimerCallback Function
Wrapper function designed to be used for callbacks called by setInterval or setTimeout in order to propagate any exceptions thrown in the callback to the main promise chain. It does this by creating a new promise for the callback invocation and adding it to the timerPromises set. The main promise chain can then await Promise.all(timerPromises) to catch any exceptions thrown in any of the callbacks. Note that if the callback completes successfully, the promise is resolved and removed from the set. If it throws an exception, the promise is rejected but not removed from the set, so that the main promise chain can detect that an error occurred and handle it appropriately.
wrapTimerCallback(timerPromises: Set<Promise<void>>, callback: () => Promise<void>): Promise<void>
Returns - Promise
Defined in
Last Updated: 25 April, 2026