fixing error handling

pull/310/head
Frostebite 2022-01-03 02:49:51 +00:00
parent 2e49376e2f
commit 9b3fcb48b4
3 changed files with 16 additions and 1 deletions

7
dist/index.js vendored
View File

@ -539,6 +539,9 @@ class Caching {
static PushToCache(cacheFolder, sourceFolder, cacheKey) {
return __awaiter(this, void 0, void 0, function* () {
try {
if (!fs_1.default.existsSync(cacheFolder)) {
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
}
if (__1.Input.cloudRunnerTests) {
yield Caching.printFullCacheHierarchySize();
}
@ -595,6 +598,10 @@ class Caching {
else {
remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
if (cacheSelection !== ``) {
if (__1.Input.cloudRunnerTests) {
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tree ${cacheFolder}`);
}
remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey}.zip doesn't exist ${destinationFolder}`);
throw new Error(`Failed to get cache item, but cache hit was found: ${cacheSelection}`);
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,10 @@ import { RemoteClientLogger } from './remote-client-logger';
export class Caching {
public static async PushToCache(cacheFolder: string, sourceFolder: string, cacheKey: string) {
try {
if (!fs.existsSync(cacheFolder)) {
await CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
}
if (Input.cloudRunnerTests) {
await Caching.printFullCacheHierarchySize();
}
@ -74,6 +78,10 @@ export class Caching {
} else {
RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
if (cacheSelection !== ``) {
if (Input.cloudRunnerTests) {
await CloudRunnerSystem.Run(`tree ${cacheFolder}`);
}
RemoteClientLogger.logWarning(`cache item ${cacheKey}.zip doesn't exist ${destinationFolder}`);
throw new Error(`Failed to get cache item, but cache hit was found: ${cacheSelection}`);
}
}