Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh committed Jan 5, 2018
1 parent 2e6c392 commit 68fb011
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/workbox-background-sync/Queue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/workbox-background-sync/node/lib/test-Queue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -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() {
Expand Down

0 comments on commit 68fb011

Please sign in to comment.