Skip to content

Commit

Permalink
With exception
Browse files Browse the repository at this point in the history
  • Loading branch information
toku-sa-n committed Feb 15, 2024
1 parent 3ca3cfe commit 8147255
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ export async function activateStatusBar({
async function updateStsatusBarItem(): Promise<void> {
const output = await runMsgfmtStatistics();

if (output) {
statusBarItem.text = output;
statusBarItem.show();
} else {
try {
if (output) {
statusBarItem.text = output;

statusBarItem.show();
} else {
statusBarItem.hide();
}
} catch (error) {
console.error(error);

statusBarItem.hide();
}
}
Expand All @@ -44,9 +51,7 @@ async function runMsgfmtStatistics(): Promise<string | null> {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(stderr);

reject(error);
reject(new Error(`Failed to run msgfmt: ${error.message}`));
} else {
// Correct. The command will print the statistics to stderr.
resolve(stderr);
Expand Down

0 comments on commit 8147255

Please sign in to comment.