Skip to content

Commit

Permalink
Fix: Ignore dialog errors in tests
Browse files Browse the repository at this point in the history
In a race condition, the bitbake error dialog could be requested before
the tests settings were applied. Also some tests do not define proper
bitbake settings because they have no need for them.

In CI only, trying to bring up an error dialog would produce an uncaught
exception which crashed the program.
  • Loading branch information
deribaucourt committed Dec 8, 2023
1 parent c94a776 commit c116f51
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions client/src/ui/ClientNotificationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import { type Memento, commands, window } from 'vscode'
import { logger } from '../lib/src/utils/OutputLogger'

export class ClientNotificationManager {
private _memento: Memento | undefined
Expand All @@ -14,19 +15,23 @@ export class ClientNotificationManager {

showBitbakeError (message?: string): void {
if (!this.checkIsNeverShowAgain('custom/bitbakeSettingsError')) {
void window.showErrorMessage(
'BitBake could not be configured and started. To enable advanced Bitbake features, please configure the Bitbake extension.',
{ detail: message, modal: true },
'Open Settings',
'Don\'t show again'
)
.then((item) => {
if (item === 'Open Settings') {
void commands.executeCommand('workbench.action.openWorkspaceSettings', '@ext:yocto-project.yocto-bitbake')
} else if (item === 'Don\'t show again') {
void this.neverShowAgain('custom/bitbakeSettingsError')
}
})
try {
void window.showErrorMessage(
'BitBake could not be configured and started. To enable advanced Bitbake features, please configure the Bitbake extension.',
{ detail: message, modal: true },
'Open Settings',
'Don\'t show again'
)
.then((item) => {
if (item === 'Open Settings') {
void commands.executeCommand('workbench.action.openWorkspaceSettings', '@ext:yocto-project.yocto-bitbake')
} else if (item === 'Don\'t show again') {
void this.neverShowAgain('custom/bitbakeSettingsError')
}
})
} catch (error) {
logger.warn('Could not show bitbake error dialog: ' + JSON.stringify(error))
}
}
}

Expand Down

0 comments on commit c116f51

Please sign in to comment.