Improve error handling

This commit is contained in:
Varun Sharma 2025-04-01 12:01:02 -07:00
commit 3e118b145b
3 changed files with 11 additions and 14 deletions

10
dist/pre/index.js vendored
View file

@ -88197,16 +88197,16 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
version: cacheUtils.getCacheVersion([cacheFilePath], compressionMethod, false),
};
const response = yield twirpClient.GetCacheEntryDownloadURL(request);
if (!response.ok) {
lib_core.debug(`Cache not found for version ${request.version} of keys: ${cacheKey}`);
return undefined;
}
const url = new URL(response.signedDownloadUrl);
lib_core.info(`Adding cacheHost: ${url.hostname}:443 to allowed-endpoints`);
confg.allowed_endpoints += ` ${url.hostname}:443`;
}
catch (e) {
lib_core.error(`v2 failed: ${e}`);
lib_core.info(`Unable to fetch cacheURL ${e}`);
if (confg.egress_policy === "block") {
lib_core.info("Switching egress-policy to audit mode");
confg.egress_policy = "audit";
}
}
break;
case "v1":

File diff suppressed because one or more lines are too long

View file

@ -145,13 +145,6 @@ interface MonitorResponse {
request
);
if (!response.ok) {
core.debug(
`Cache not found for version ${request.version} of keys: ${cacheKey}`
);
return undefined;
}
const url = new URL(response.signedDownloadUrl);
core.info(
`Adding cacheHost: ${url.hostname}:443 to allowed-endpoints`
@ -159,7 +152,11 @@ interface MonitorResponse {
confg.allowed_endpoints += ` ${url.hostname}:443`;
} catch (e) {
core.error(`v2 failed: ${e}`);
core.info(`Unable to fetch cacheURL ${e}`);
if (confg.egress_policy === "block") {
core.info("Switching egress-policy to audit mode");
confg.egress_policy = "audit";
}
}
break;