diff --git a/packages/workbox-background-sync/Queue.mjs b/packages/workbox-background-sync/Queue.mjs index e9bb839f31..63abcdff4f 100644 --- a/packages/workbox-background-sync/Queue.mjs +++ b/packages/workbox-background-sync/Queue.mjs @@ -104,8 +104,6 @@ class Queue { * `queueDidReplay` callback is invoked (which implies the queue is * now empty). If any of the requests fail, a new sync registration is * created to retry again later. - * - * @return {Promise} */ async replayRequests() { const now = Date.now(); @@ -137,13 +135,13 @@ class Queue { await this._runCallback('queueDidReplay', replayedRequests); // If any requests failed, put the failed requests back in the queue - // and reject promise. + // and rethrow the failed requests. if (failedRequests.length) { await Promise.all(failedRequests.map((storableRequest) => { return this._queueStore.addEntry(storableRequest); })); - return Promise.reject(failedRequests); + throw new Error(failedRequests); } } diff --git a/test/workbox-background-sync/node/lib/test-Queue.mjs b/test/workbox-background-sync/node/lib/test-Queue.mjs index 113fef0337..626b70900e 100644 --- a/test/workbox-background-sync/node/lib/test-Queue.mjs +++ b/test/workbox-background-sync/node/lib/test-Queue.mjs @@ -304,7 +304,7 @@ describe(`[workbox-background-sync] Queue`, function() { return; } - return Promise.reject('should have exit from catch'); + throw new Error('should have exit from catch'); }); it(`should reject replayRequests promise if re-fetching fails`, @@ -329,7 +329,7 @@ describe(`[workbox-background-sync] Queue`, function() { return; } - return Promise.reject('should have exit from catch'); + throw new Error('should have exit from catch'); }); it(`should invoke all replay callbacks`, async function() {