export async function attempts(...fns: (() => Promise)[]): Promise { let lastError: any for (const fn of fns) { try { return await fn() } catch (e) { lastError = e continue } } throw lastError }