Skip to content

Commit

Permalink
Merge pull request #24 from t0yv0/master
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxxstorm authored May 20, 2022
2 parents cceeb32 + 1023e6a commit d919e59
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
16 changes: 15 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,21 @@ function run() {
const binPath = yield tc.downloadTool(url);
yield extractFn(binPath, dest);
if (cacheEnabled && cacheKey !== undefined) {
yield cache.saveCache([dest], cacheKey);
try {
yield cache.saveCache([dest], cacheKey);
}
catch (error) {
const typedError = error;
if (typedError.name === cache.ValidationError.name) {
throw error;
}
else if (typedError.name === cache.ReserveCacheError.name) {
core.info(typedError.message);
}
else {
core.warning(typedError.message);
}
}
}
core.addPath(dest);
core.info(`Successfully extracted ${project} to ${dest}`);
Expand Down
13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,18 @@ async function run() {
await extractFn(binPath, dest);

if (cacheEnabled && cacheKey !== undefined) {
await cache.saveCache([dest], cacheKey);
try {
await cache.saveCache([dest], cacheKey);
} catch (error) {
const typedError = error as Error;
if (typedError.name === cache.ValidationError.name) {
throw error;
} else if (typedError.name === cache.ReserveCacheError.name) {
core.info(typedError.message);
} else {
core.warning(typedError.message);
}
}
}

core.addPath(dest);
Expand Down

0 comments on commit d919e59

Please sign in to comment.