@@ -7,11 +7,11 @@ import globals from '../extensionGlobals'
77import { AwsClient , AwsClientConstructor , AwsCommand , AwsCommandConstructor } from '../awsClientBuilderV3'
88import { PaginationConfiguration , Paginator } from '@aws-sdk/types'
99import { 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
1616type 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+ // }
0 commit comments