Skip to content

Commit

Permalink
Cache SW: Ensure any failure is always logged. (ampproject#8328)
Browse files Browse the repository at this point in the history
* Ensure any failure is always logged.

* lint

* Tell closure compiler it'll be alright.
  • Loading branch information
jridgewell authored and mrjoro committed Apr 28, 2017
1 parent e682e43 commit dd261ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/service-worker/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ export function handleFetch(request, maybeClientId) {

// Wait for the cachePromise to resolve. This is necessary
// since the SW thread may be killed and restarted at any time.
return cachePromise.then(() => {
return /** @type {!Promise<!Response>} */ (cachePromise.then(() => {
// If we already registered this client, we must always use the same
// version.
if (clientsVersion[clientId]) {
Expand Down Expand Up @@ -625,7 +625,11 @@ export function handleFetch(request, maybeClientId) {
// If not, let's fetch and cache the request.
return fetchJsFile(cache, versionedRequest, version, pathname);
});
});
}).catch(err => {
// Throw error out of band.
Promise.reject(err);
throw err;
}));
}


Expand Down

0 comments on commit dd261ee

Please sign in to comment.