mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 01:30:10 +08:00
Don't crash if we are unable to get a response from the feature-flag endpoint.
This commit is contained in:
committed by
GitHub
parent
d8c9c723a5
commit
01fa64cb90
@@ -31,14 +31,21 @@ export class GitHubFeatureFlags implements FeatureFlags {
|
||||
) {}
|
||||
|
||||
async getValue(flag: FeatureFlag): Promise<boolean> {
|
||||
const response = (await this.getApiResponse())[flag];
|
||||
const response = await this.getApiResponse();
|
||||
if (response === undefined) {
|
||||
this.logger.debug(
|
||||
`No feature flags API response for ${flag}, considering it disabled.`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const flag_value = response[flag];
|
||||
if (flag_value === undefined) {
|
||||
this.logger.debug(
|
||||
`Feature flag '${flag}' undefined in API response, considering it disabled.`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return response;
|
||||
return flag_value;
|
||||
}
|
||||
|
||||
private async getApiResponse(): Promise<FeatureFlagsApiResponse> {
|
||||
|
||||
Reference in New Issue
Block a user