Skip to content

Commit 597393d

Browse files
committed
test: remove client wrapping for debugging
1 parent 8ef5619 commit 597393d

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

packages/core/src/shared/clients/clientWrapper.ts

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import globals from '../extensionGlobals'
77
import { AwsClient, AwsClientConstructor, AwsCommand, AwsCommandConstructor } from '../awsClientBuilderV3'
88
import { PaginationConfiguration, Paginator } from '@aws-sdk/types'
99
import { AsyncCollection, toCollection } from '../utilities/asyncCollection'
10-
import { hasKey, isDefined } from '../utilities/tsUtils'
11-
import { PerfLog } from '../logger/perfLogger'
12-
import { truncateProps } from '../utilities/textUtilities'
13-
import { getLogger } from '../logger/logger'
14-
import { ToolkitError } from '../errors'
10+
import { isDefined } from '../utilities/tsUtils'
11+
// import { PerfLog } from '../logger/perfLogger'
12+
// import { truncateProps } from '../utilities/textUtilities'
13+
// import { getLogger } from '../logger/logger'
14+
// import { ToolkitError } from '../errors'
1515

1616
type SDKPaginator<C, CommandInput extends object, CommandOutput extends object> = (
1717
config: Omit<PaginationConfiguration, 'client'> & { client: C },
@@ -39,25 +39,26 @@ export abstract class ClientWrapper<C extends AwsClient> implements vscode.Dispo
3939
CommandOptions extends CommandInput,
4040
Command extends AwsCommand<CommandInput, CommandOutput>,
4141
>(command: AwsCommandConstructor<CommandInput, Command>, commandOptions: CommandOptions): Promise<CommandOutput> {
42-
const action = 'API Request'
43-
const perflog = new PerfLog(action)
44-
return await this.getClient()
45-
.send(new command(commandOptions))
46-
.catch((e) => {
47-
const errWithoutStack = { ...e, name: e.name, message: e.message }
48-
delete errWithoutStack['stack']
49-
const timecost = perflog.elapsed().toFixed(1)
50-
getLogger().error(
51-
`${action} failed (time: %dms) \nparams: %O\nerror: %O`,
52-
timecost,
53-
truncateProps(commandOptions, 20, ['nextToken']),
54-
errWithoutStack
55-
)
56-
throw new ToolkitError(`${action}: ${errWithoutStack.message}`, {
57-
code: extractCode(errWithoutStack),
58-
cause: errWithoutStack,
59-
})
60-
})
42+
// const action = 'API Request'
43+
// const perflog = new PerfLog(action)
44+
return await this.getClient().send(new command(commandOptions))
45+
// return await this.getClient()
46+
// .send(new command(commandOptions))
47+
// .catch((e) => {
48+
// const errWithoutStack = { ...e, name: e.name, message: e.message }
49+
// delete errWithoutStack['stack']
50+
// const timecost = perflog.elapsed().toFixed(1)
51+
// getLogger().error(
52+
// `${action} failed (time: %dms) \nparams: %O\nerror: %O`,
53+
// timecost,
54+
// truncateProps(commandOptions, 20, ['nextToken']),
55+
// errWithoutStack
56+
// )
57+
// throw new ToolkitError(`${action}: ${errWithoutStack.message}`, {
58+
// code: extractCode(errWithoutStack),
59+
// cause: errWithoutStack,
60+
// })
61+
// })
6162
}
6263

6364
protected makePaginatedRequest<CommandInput extends object, CommandOutput extends object, Output extends object>(
@@ -88,10 +89,10 @@ export abstract class ClientWrapper<C extends AwsClient> implements vscode.Dispo
8889
}
8990
}
9091

91-
function extractCode(e: Error): string {
92-
return hasKey(e, 'code') && typeof e['code'] === 'string'
93-
? e.code
94-
: hasKey(e, 'Code') && typeof e['Code'] === 'string'
95-
? e.Code
96-
: e.name
97-
}
92+
// function extractCode(e: Error): string {
93+
// return hasKey(e, 'code') && typeof e['code'] === 'string'
94+
// ? e.code
95+
// : hasKey(e, 'Code') && typeof e['Code'] === 'string'
96+
// ? e.Code
97+
// : e.name
98+
// }

packages/core/src/testE2E/codecatalyst/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let projectName: CodeCatalystProject['name']
8888
* integ tests, but using the ssh hostname that we get from
8989
* {@link prepareDevEnvConnection}.
9090
*/
91-
describe('Test how this codebase uses the CodeCatalyst API', function () {
91+
describe.only('Test how this codebase uses the CodeCatalyst API', function () {
9292
let client: CodeCatalystClient
9393
let commands: CodeCatalystCommands
9494
let webviewClient: CodeCatalystCreateWebview

0 commit comments

Comments
 (0)