Skip to content

fix(tests): "rejected promise not handled" #7403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/amazonq/src/app/chat/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode'
import { ExtensionContext } from 'vscode'
import { telemetry } from 'aws-core-vscode/telemetry'
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
import { Commands, placeholder } from 'aws-core-vscode/shared'
import { Commands, getLogger, placeholder } from 'aws-core-vscode/shared'
import * as amazonq from 'aws-core-vscode/amazonq'

export async function activate(context: ExtensionContext) {
Expand Down Expand Up @@ -67,7 +67,9 @@ async function setupAuthNotification() {
const selection = await vscode.window.showWarningMessage('Start using Amazon Q', buttonAction)

if (selection === buttonAction) {
void amazonq.focusAmazonQPanel.execute(placeholder, source)
amazonq.focusAmazonQPanel.execute(placeholder, source).catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}
}
}
4 changes: 3 additions & 1 deletion packages/amazonq/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
// Give time for the extension to finish initializing.
globals.clock.setTimeout(async () => {
CommonAuthWebview.authSource = ExtStartUpSources.firstStartUp
void focusAmazonQPanel.execute(placeholder, ExtStartUpSources.firstStartUp)
focusAmazonQPanel.execute(placeholder, ExtStartUpSources.firstStartUp).catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}, 1000)
}

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/amazonq/auth/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { getLogger } from '../../shared/logger/logger'
import { reconnect } from '../../codewhisperer/commands/basicCommands'
import { amazonQChatSource } from '../../codewhisperer/commands/types'
import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerCommands'
Expand All @@ -27,7 +28,9 @@ export class AuthController {
}

private handleFullAuth() {
void focusAmazonQPanel.execute(placeholder, 'amazonQChat')
focusAmazonQPanel.execute(placeholder, 'amazonQChat').catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}

private handleReAuth() {
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/codewhisperer/commands/basicCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ export const notifyNewCustomizationsCmd = Commands.declare(
function focusQAfterDelay() {
// this command won't work without a small delay after install
globals.clock.setTimeout(() => {
void focusAmazonQPanel.execute(placeholder, 'startDelay')
focusAmazonQPanel.execute(placeholder, 'startDelay').catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}, 1000)
}

Expand Down Expand Up @@ -597,7 +599,10 @@ export const signoutCodeWhisperer = Commands.declare(
(auth: AuthUtil) => async (_: VsCodeCommandArg, source: CodeWhispererSource) => {
await auth.secondaryAuth.deleteConnection()
SecurityIssueTreeViewProvider.instance.refresh()
return focusAmazonQPanel.execute(placeholder, source)
return focusAmazonQPanel.execute(placeholder, source).catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
return undefined
})
}
)

Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/codewhisperer/ui/codeWhispererNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { AuthUtil } from '../util/authUtil'
import { submitFeedback } from '../../feedback/vue/submitFeedback'
import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerCommands'
import { isWeb } from '../../shared/extensionGlobals'
import { getLogger } from '../../shared/logger/logger'

export function createAutoSuggestions(running: boolean): DataQuickPickItem<'autoSuggestions'> {
const labelResume = localize('AWS.codewhisperer.resumeCodeWhispererNode.label', 'Resume Auto-Suggestions')
Expand Down Expand Up @@ -238,7 +239,10 @@ export function switchToAmazonQNode(): DataQuickPickItem<'openChatPanel'> {
data: 'openChatPanel',
label: 'Open Chat Panel',
iconPath: getIcon('vscode-comment'),
onClick: () => focusAmazonQPanel.execute(placeholder, 'codewhispererQuickPick'),
onClick: () =>
focusAmazonQPanel.execute(placeholder, 'codewhispererQuickPick').catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
}),
}
}

Expand All @@ -247,7 +251,9 @@ export function createSignIn(): DataQuickPickItem<'signIn'> {
const icon = getIcon('vscode-account')

let onClick = () => {
void focusAmazonQPanel.execute(placeholder, 'codewhispererQuickPick')
focusAmazonQPanel.execute(placeholder, 'codewhispererQuickPick').catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}
if (isWeb()) {
// TODO: nkomonen, call a Command instead
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/codewhisperer/util/authUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ export class AuthUtil {
} catch (err) {
if (err instanceof ProfileNotFoundError) {
// Expected that connection would be deleted by conn.getToken()
void focusAmazonQPanel.execute(placeholder, 'profileNotFoundSignout')
focusAmazonQPanel.execute(placeholder, 'profileNotFoundSignout').catch((e) => {
getLogger().error('focusAmazonQPanel failed: %s', e)
})
}
throw err
}
Expand Down
Loading