Handle ReserveCacheError with a nicer message
This commit is contained in:
parent
5cb4249dc7
commit
b0c0aadc56
3 changed files with 35 additions and 5 deletions
|
|
@ -181,10 +181,25 @@ export async function uploadDependencyCaches(config: Config, logger: Logger) {
|
|||
const key = await cacheKey(language, cacheConfig);
|
||||
|
||||
logger.info(
|
||||
`Uploading cache of size ${size} for ${language} with key ${key}`,
|
||||
`Uploading cache of size ${size} for ${language} with key ${key}...`,
|
||||
);
|
||||
|
||||
await actionsCache.saveCache(cacheConfig.paths, 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