ref: a9c63b53059c842e31b52d1226aec78c6372fcc3 bad promise rejection handling

This commit is contained in:
Clem 2023-08-25 13:43:43 +02:00
parent 7687972e65
commit 49f9a10372
5 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@ export class CoreCommandProvider extends CommandProvider {
}
async activate () {
const profile = await this.profilesService.showProfileSelector()
const profile = await this.profilesService.showProfileSelector().catch(() => null)
if (profile) {
this.profilesService.launchProfile(profile)
}

View File

@ -191,7 +191,7 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
this.showSelector(provider)
}
if (hotkey === 'command-selector') {
commands.showSelector()
commands.showSelector().catch(() => {return})
}
if (hotkey === 'profile-selector') {

View File

@ -101,7 +101,7 @@ export class CommandService {
context.tab = tab.getFocusedTab() ?? undefined
}
const commands = await this.getCommands(context)
await this.selector.show(
return this.selector.show(
this.translate.instant('Commands'),
commands.map(c => ({
name: c.label,
@ -109,6 +109,6 @@ export class CommandService {
description: c.sublabel,
icon: c.icon,
})),
).catch(() => {return})
).then(() => {return})
}
}

View File

@ -323,7 +323,7 @@ export class ProfilesService {
}
})
await this.selector.show(this.translate.instant('Select profile or enter an address'), options).catch(() => resolve(null))
await this.selector.show(this.translate.instant('Select profile or enter an address'), options).catch(() => reject())
} catch (err) {
reject(err)
}

View File

@ -262,7 +262,7 @@ export class ProfilesContextMenu extends TabContextMenuItemProvider {
}
async switchTabProfile (tab: BaseTabComponent) {
const profile = await this.profilesService.showProfileSelector()
const profile = await this.profilesService.showProfileSelector().catch(() => null)
if (!profile) {
return
}