
In some cases, example when the user clears the caches in DevTools but the SW remains active on another tab and keeps references to the deleted caches, trying to write to the cache throws errors (e.g. `Entry was not found`). When this happens, the SW can no longer work correctly and should enter a degraded mode allowing requests to be served from the network. Possibly related: - https://github.com/GoogleChrome/workbox/issues/792 - https://bugs.chromium.org/p/chromium/issues/detail?id=639034 This commits remedies this situation, by ensuring the SW can enter the degraded `EXISTING_CLIENTS_ONLY` mode and forward requests to the network. PR Close #26042
18 lines
460 B
TypeScript
18 lines
460 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
export class SwCriticalError extends Error { readonly isCritical: boolean = true; }
|
|
|
|
export function errorToString(error: any): string {
|
|
if (error instanceof Error) {
|
|
return `${error.message}\n${error.stack}`;
|
|
} else {
|
|
return `${error}`;
|
|
}
|
|
}
|