title: sw-precache: Deleted cache, FetchEvent error response
body: <p>I am using sw-precache for adding offline support to a web app.  </p>
  
  <p>My setup:</p>
  
  <ol>
  <li>Static website with CSS/JS/HTML Dynamic content is handled via
  custom indexedDB solution.</li>
  <li>Grunt task used generate the service-worker.</li>
  <li>sw-precache (4.0.0) used to cache ALL the static
  assets.</li>
  <li>cache headers on service-worker.js set on apache as
  follows:</li>
  </ol>
  
  <blockquote>
  <pre><code>&lt;LocationMatch "service-worker\.js.*"&gt;
      Header set Cache-Control "max-age=0, no-cache"
  &lt;/LocationMatch&gt;
  </code></pre>
  </blockquote>
  
  <p>Things seem to work fine in usual cases. But if for some reason, the user clears the cache (e.g In chrome dev tools -> Applications -> Clear Storage  (Select everything) -> click 'clear selected'), my web pages don't load <strong>even If I am online</strong> and I see following error in console:</p>
  
  <p>The FetchEvent for "<a href="https://my.somedomain.com/somepath/somepage.html" rel="nofollow noreferrer">https://my.somedomain.com/somepath/somepage.html</a>" resulted in a network error response: an object that was not a Response was passed to respondWith().</p>
  
  <p>When I look at the generated service-worker.js, I notice the following code. </p>
  
  <pre><code>// If shouldRespond was set to true at any point, then call
  // event.respondWith(), using the appropriate cache key.
  if (shouldRespond) {
    event.respondWith(
      caches.open(cacheName).then(function(cache) {
        return cache.match(urlsToCacheKeys.get(url));
      }).catch(function(e) {
        // Fall back to just fetch()ing the request if some unexpected error
        // prevented the cached response from being valid.
        console.warn('Couldn\'t serve response for "%s" from cache: %O', event.request.url, e);
        return fetch(event.request);
      })
    );
  </code></pre>
  
  <p>When debugging, I don't see the catch block getting executed. Also see the attached debug output of the object returned catch.match that is passed to respondWith()
  <a href="https://i.stack.imgur.com/7OVBT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7OVBT.png" alt="Console debug output of promise object passed to respondWith"></a></p>
  
  <p>So my questions:</p>
  
  <ol>
  <li>Why does sw-precache not fallback to network when it does not find the entry in cache? </li>
  <li>Is there anyway to force network request when a request entry is not found in cache?   </li>
  </ol>