fix unhandled runtime error, and ignore doesn't exist error

This commit is contained in:
Abhinav 2023-12-16 10:27:11 +05:30
parent ebc65741a4
commit 0dd6dadd12

View file

@ -35,7 +35,10 @@ export class DiskCache implements LimitedCache {
Error(), Error(),
'Cache key exists but size does not match. Deleting cache key.' 'Cache key exists but size does not match. Deleting cache key.'
); );
unlink(cachePath); unlink(cachePath).catch((e) => {
if (e.code === 'ENOENT') return;
logError(e, 'Failed to delete cache key');
});
return undefined; return undefined;
} }
DiskLRUService.touch(cachePath); DiskLRUService.touch(cachePath);
@ -53,7 +56,10 @@ export class DiskCache implements LimitedCache {
Error(), Error(),
'Old cache key exists but size does not match. Deleting cache key.' 'Old cache key exists but size does not match. Deleting cache key.'
); );
unlink(oldCachePath); unlink(oldCachePath).catch((e) => {
if (e.code === 'ENOENT') return;
logError(e, 'Failed to delete cache key');
});
return undefined; return undefined;
} }
const match = new Response(await getFileStream(oldCachePath)); const match = new Response(await getFileStream(oldCachePath));