Handle ReserveCacheError with a nicer message
This commit is contained in:
parent
5cb4249dc7
commit
b0c0aadc56
3 changed files with 35 additions and 5 deletions
19
lib/dependency-caching.js
generated
19
lib/dependency-caching.js
generated
|
|
@ -147,8 +147,23 @@ async function uploadDependencyCaches(config, logger) {
|
|||
continue;
|
||||
}
|
||||
const key = await cacheKey(language, cacheConfig);
|
||||
logger.info(`Uploading cache of size ${size} for ${language} with key ${key}`);
|
||||
await actionsCache.saveCache(cacheConfig.paths, key);
|
||||
logger.info(`Uploading cache of size ${size} for ${language} with key ${key}...`);
|
||||
try {
|
||||
await actionsCache.saveCache(cacheConfig.paths, key);
|
||||
}
|
||||
catch (error) {
|
||||
// `ReserveCacheError` indicates that the cache key is already in use, which means that a
|
||||
// cache with that key already exists or is in the process of being uploaded by another
|
||||
// workflow. We can ignore this.
|
||||
if (error instanceof actionsCache.ReserveCacheError) {
|
||||
logger.info(`Not uploading cache for ${language}, because ${key} is already in use.`);
|
||||
logger.debug(error.message);
|
||||
}
|
||||
else {
|
||||
// Propagate other errors upwards.
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue