Skip to content

Commit

Permalink
fix: do not let voiding promises
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Golovin <[email protected]>
  • Loading branch information
dgolovin committed Aug 13, 2024
1 parent e1eaa5b commit 0f4cb6a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-floating-promises": ["error", {"ignoreVoid": false}],

/**
* Having a semicolon helps the optimizer interpret your code correctly.
Expand Down
2 changes: 1 addition & 1 deletion src/crc-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function setUpCrc(logger: extensionApi.Logger, askForPreset = false
setupBar.text = 'All done.';
} catch (err) {
console.error(err);
void extensionApi.window.showErrorMessage(`${productName} configuration failed:\n${err}`);
await extensionApi.window.showErrorMessage(`${productName} configuration failed:\n${err}`);
return false;
} finally {
setupBar.hide();
Expand Down
6 changes: 3 additions & 3 deletions src/crc-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function startCrc(
return true;
} else {
provider.updateStatus('error');
void extensionApi.window.showErrorMessage(`Error during starting ${productName}: ${result.Status}`);
await extensionApi.window.showErrorMessage(`Error during starting ${productName}: ${result.Status}`);
}
} catch (err) {
if (typeof err.message === 'string') {
Expand All @@ -84,7 +84,7 @@ export async function startCrc(
return true;
}
}
void extensionApi.window.showErrorMessage(`${productName} start error: ${err}`);
await extensionApi.window.showErrorMessage(`${productName} start error: ${err}`);
console.error(err);
provider.updateStatus('stopped');
}
Expand Down Expand Up @@ -137,7 +137,7 @@ async function askAndStorePullSecret(logger: extensionApi.Logger): Promise<boole
}
} catch (err) {
// not valid json
void extensionApi.window.showErrorMessage(`Start failed, pull secret is not valid. Please start again:\n '${err}'`);
await extensionApi.window.showErrorMessage(`Start failed, pull secret is not valid. Please start again:\n '${err}'`);
return false;
}
try {
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ async function presetChanged(

if (preset === 'podman') {
// do nothing
void extensionApi.window.showInformationMessage(
await extensionApi.window.showInformationMessage(
'Currently we do not support the Podman preset of OpenShift Local. Please use preference to change this:\n\nSettings > Preferences > Red Hat OpenShift Local > Preset',
'OK',
);
Expand Down
4 changes: 2 additions & 2 deletions src/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function handleProxyChange(proxy?: extensionApi.ProxySettings): Promise<vo
}
} catch (err) {
console.error(err);
void extensionApi.window.showErrorMessage(`Could not update ${productName} proxy configuration: ${err}`);
await extensionApi.window.showErrorMessage(`Could not update ${productName} proxy configuration: ${err}`);
}
}

Expand Down Expand Up @@ -164,7 +164,7 @@ async function configChanged(
if (element.validation) {
const validationResult = element.validation(newValue, currentConfig.preset);
if (validationResult) {
void extensionApi.window.showErrorMessage(validationResult);
await extensionApi.window.showErrorMessage(validationResult);
await extConfig.update(key, currentConfig[element.name]);
continue;
}
Expand Down

0 comments on commit 0f4cb6a

Please sign in to comment.