Skip to content

Commit ec20b19

Browse files
committed
revert recommendationHandler.ts, startSecurityScan.test.ts and skip falky appbuilder walkthrough test
1 parent d2d5d19 commit ec20b19

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

packages/core/src/codewhisperer/service/recommendationHandler.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import * as EditorContext from '../util/editorContext'
1010
import * as CodeWhispererConstants from '../models/constants'
1111
import { ConfigurationEntry, GetRecommendationsResponse, vsCodeState } from '../models/model'
1212
import { runtimeLanguageContext } from '../util/runtimeLanguageContext'
13-
import { ServiceException } from '@smithy/smithy-client'
14-
import { isServiceException } from '../../shared/errors'
13+
import { AWSError } from 'aws-sdk'
14+
import { isAwsError } from '../../shared/errors'
1515
import { TelemetryHelper } from '../util/telemetryHelper'
1616
import { getLogger } from '../../shared/logger/logger'
1717
import { hasVendedIamCredentials } from '../../auth/auth'
@@ -290,14 +290,14 @@ export class RecommendationHandler {
290290
latency = startTime !== 0 ? Date.now() - startTime : 0
291291
}
292292
getLogger().error('amazonq inline-suggest: Invocation Exception : %s', (error as Error).message)
293-
if (isServiceException(error)) {
293+
if (isAwsError(error)) {
294294
errorMessage = error.message
295-
requestId = error.$metadata.requestId || ''
296-
errorCode = error.name
297-
reason = `CodeWhisperer Invocation Exception: ${error?.name ?? 'unknown'}`
295+
requestId = error.requestId || ''
296+
errorCode = error.code
297+
reason = `CodeWhisperer Invocation Exception: ${error?.code ?? error?.name ?? 'unknown'}`
298298
await this.onThrottlingException(error, triggerType)
299299

300-
if (error?.name === 'AccessDeniedException' && errorMessage?.includes('no identity-based policy')) {
300+
if (error?.code === 'AccessDeniedException' && errorMessage?.includes('no identity-based policy')) {
301301
getLogger().error('amazonq inline-suggest: AccessDeniedException : %s', (error as Error).message)
302302
void vscode.window
303303
.showErrorMessage(`CodeWhisperer: ${error?.message}`, CodeWhispererConstants.settingsLearnMore)
@@ -574,9 +574,9 @@ export class RecommendationHandler {
574574
return true
575575
}
576576

577-
async onThrottlingException(awsError: ServiceException, triggerType: CodewhispererTriggerType) {
577+
async onThrottlingException(awsError: AWSError, triggerType: CodewhispererTriggerType) {
578578
if (
579-
awsError.name === 'ThrottlingException' &&
579+
awsError.code === 'ThrottlingException' &&
580580
awsError.message.includes(CodeWhispererConstants.throttlingMessage)
581581
) {
582582
if (triggerType === 'OnDemand') {

packages/core/src/test/awsService/appBuilder/walkthrough.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const scenarios: TestScenario[] = [
8383
},
8484
]
8585

86-
describe('AppBuilder Walkthrough', function () {
86+
describe.skip('AppBuilder Walkthrough', function () {
8787
before(async function () {
8888
// ensure auto scan is disabled before testrun
8989
await CodeScansState.instance.setScansEnabled(false)

packages/core/src/test/codewhisperer/startSecurityScan.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import * as diagnosticsProvider from '../../codewhisperer/service/diagnosticsPro
1414
import { getTestWorkspaceFolder } from '../../testInteg/integrationTestsUtilities'
1515
import { join } from 'path'
1616
import { assertTelemetry, closeAllEditors, getFetchStubWithResponse } from '../testUtil'
17-
import { ServiceException } from '@smithy/smithy-client'
17+
import { AWSError } from 'aws-sdk'
1818
import { getTestWindow } from '../shared/vscode/window'
1919
import { SeverityLevel } from '../shared/vscode/message'
2020
import { cancel } from '../../shared/localizedText'
@@ -334,11 +334,11 @@ describe('startSecurityScan', function () {
334334
getFetchStubWithResponse({ status: 200, statusText: 'testing stub' })
335335
const mockClient = createClient()
336336
mockClient.createCodeScan.throws({
337-
name: 'ThrottlingException',
337+
code: 'ThrottlingException',
338+
time: new Date(),
339+
name: 'error name',
338340
message: scansLimitReachedErrorMessage,
339-
$fault: 'client',
340-
$metadata: {},
341-
} satisfies ServiceException)
341+
} satisfies AWSError)
342342
sinon.stub(errors, 'isAwsError').returns(true)
343343
const testWindow = getTestWindow()
344344
await startSecurityScan.startSecurityScan(
@@ -365,11 +365,11 @@ describe('startSecurityScan', function () {
365365
await model.CodeScansState.instance.setScansEnabled(true)
366366
const mockClient = createClient()
367367
mockClient.createCodeScan.throws({
368-
name: 'ThrottlingException',
368+
code: 'ThrottlingException',
369+
time: new Date(),
370+
name: 'error name',
369371
message: 'Maximum file scans count reached for this month',
370-
$fault: 'client',
371-
$metadata: {},
372-
} satisfies ServiceException)
372+
} satisfies AWSError)
373373
sinon.stub(errors, 'isAwsError').returns(true)
374374
assert.equal(model.CodeScansState.instance.isMonthlyQuotaExceeded(), false)
375375
await startSecurityScan.startSecurityScan(

0 commit comments

Comments
 (0)