Fix review points

This commit is contained in:
Ivan Zosimov 2022-04-20 17:36:08 +02:00
parent 832658fa34
commit ede5159e42
2 changed files with 16 additions and 18 deletions

View file

@ -35,19 +35,20 @@ const cachePackages = async () => {
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
let pathsCounter = cachePaths.length;
const nonExistingPaths = cachePaths.filter(
cachePath => !fs.existsSync(cachePath)
);
for (let path of cachePaths) {
if (!fs.existsSync(path)) {
logWarning(
`Cache folder path is retrieved but doesn't exist on disk: ${path}`
);
pathsCounter--;
}
if (nonExistingPaths.length === cachePaths.length) {
throw new Error(`No cache folders exist on disk`);
}
if (!pathsCounter) {
throw new Error(`No cache folders exist on disk`);
if (nonExistingPaths.length) {
logWarning(
`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(
', '
)}`
);
}
if (primaryKey === state) {