Skip to content

Commit 2dc3847

Browse files
authored
fix: void unhandled promise return values in configure-aws (#105)
- Add `void` operator to unhandled `window.showErrorMessage` and `window.showInformationMessage` calls to explicitly discard their promise return values - Fix `credentialsNeedsOverride` not needing an `await` but being awaited for
1 parent a14e1a0 commit 2dc3847

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/utils/configure-aws.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async function configureAwsConfigProfile(
201201
return true;
202202
} catch (error) {
203203
const errorMessage = error instanceof Error ? error.message : String(error);
204-
window.showErrorMessage(
204+
void window.showErrorMessage(
205205
`Failed to configure the AWS profile named "localstack" in [${awsConfigFilenameReadable}]: ${errorMessage}`,
206206
);
207207
}
@@ -259,7 +259,7 @@ async function configureCredentialsProfile(
259259
return true;
260260
} catch (error) {
261261
const errorMessage = error instanceof Error ? error.message : String(error);
262-
window.showErrorMessage(
262+
void window.showErrorMessage(
263263
`Failed to configure the AWS profile named "localstack" in [${awsCredentialsFilenameReadable}]: ${errorMessage}`,
264264
);
265265
}
@@ -340,7 +340,7 @@ export async function configureAwsProfiles(options: {
340340
if (!configNeedsOverride && !credentialsNeedsOverride) {
341341
// if everything in place, show user that no changes were made and return
342342
if (options?.notifyNoChangesMade) {
343-
window.showInformationMessage(
343+
void window.showInformationMessage(
344344
'The AWS profile named "localstack" was already present, so no changes were made.',
345345
);
346346
}
@@ -410,7 +410,7 @@ export async function configureAwsProfiles(options: {
410410
overrideDecision,
411411
),
412412
]);
413-
window.showInformationMessage(
413+
void window.showInformationMessage(
414414
'Successfully added the AWS profile named "localstack" to "~/.aws/config" and "~/.aws/credentials".',
415415
);
416416
options.telemetry?.track({
@@ -434,7 +434,7 @@ export async function configureAwsProfiles(options: {
434434
overrideDecision,
435435
options.outputChannel,
436436
);
437-
window.showInformationMessage(
437+
void window.showInformationMessage(
438438
'Successfully added the AWS profile named "localstack" to "~/.aws/config".',
439439
);
440440
options.telemetry?.track({
@@ -457,7 +457,7 @@ export async function configureAwsProfiles(options: {
457457
credentialsSection,
458458
overrideDecision,
459459
);
460-
window.showInformationMessage(
460+
void window.showInformationMessage(
461461
'Successfully added the AWS profile named "localstack" to "~/.aws/credentials".',
462462
);
463463
options.telemetry?.track({
@@ -487,10 +487,9 @@ export async function checkIsProfileConfigured(): Promise<boolean> {
487487
),
488488
]);
489489

490-
const [configNeedsOverride, credentialsNeedsOverride] = await Promise.all([
491-
checkIfConfigNeedsOverride(configSection),
492-
checkIfCredentialsNeedsOverride(credentialsSection),
493-
]);
490+
const configNeedsOverride = await checkIfConfigNeedsOverride(configSection);
491+
const credentialsNeedsOverride =
492+
checkIfCredentialsNeedsOverride(credentialsSection);
494493

495494
if (configNeedsOverride || credentialsNeedsOverride) {
496495
return false;

0 commit comments

Comments
 (0)