Skip to content

Commit

Permalink
Merge pull request #8 from sutaC/dev
Browse files Browse the repository at this point in the history
Error handling sw
  • Loading branch information
sutaC authored Nov 6, 2023
2 parents 0d182ea + c71fcb7 commit 3da5376
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ const assets = [
"/docs/assets/icon-reset.svg",
];
async function cacheStatic() {
const cache = await caches.open(stataicCacheName);
await cache.addAll(assets);
try {
const cache = await caches.open(stataicCacheName);
await cache.addAll(assets);
}
catch (error) {
console.error(error);
}
}
async function deleteCache() {
const keys = await caches.keys();
Expand Down
8 changes: 6 additions & 2 deletions sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ const assets = [
];

async function cacheStatic(): Promise<void> {
const cache = await caches.open(stataicCacheName);
await cache.addAll(assets);
try {
const cache = await caches.open(stataicCacheName);
await cache.addAll(assets);
} catch (error) {
console.error(error);
}
}

async function deleteCache(): Promise<void> {
Expand Down

0 comments on commit 3da5376

Please sign in to comment.