Skip to content

Commit 0fdf701

Browse files
committed
fix: avoid duplicating error in the logs
1 parent 1ec3170 commit 0fdf701

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export async function onDeserialize<Input extends object, Output extends object>
263263
const err = { ...e, name: e.name, mesage: e.message }
264264
delete err['stack']
265265
recordErrorTelemetry(err, serviceId)
266-
getLogger().error(`API Error %s: %O`, logTail, err)
266+
getLogger().warn(`API Request %s resulted in error: %O`, logTail, err)
267267
}
268268
throw e
269269
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export abstract class ClientWrapper<C extends AwsClient> implements vscode.Dispo
6363
const errWithoutStack = { ...e, name: e.name, message: e.message }
6464
delete errWithoutStack['stack']
6565
const timecost = perflog.elapsed().toFixed(1)
66-
getLogger().error(
67-
`${action} failed (time: %dms) \nparams: %O\nerror: %O`,
68-
timecost,
69-
truncateProps(commandOptions, 20, ['nextToken']),
70-
errWithoutStack
71-
)
7266
if (requestOptions?.fallbackValue) {
7367
return requestOptions.fallbackValue
7468
}
69+
// Error is already logged in middleware before this, so we omit it here.
70+
getLogger().error(
71+
`${action} failed without fallback (time: %dms) \nparams: %O`,
72+
timecost,
73+
truncateProps(commandOptions, 20, ['nextToken'])
74+
)
7575
throw new ToolkitError(`${action}: ${errWithoutStack.message}`, {
7676
code: extractCode(errWithoutStack),
7777
cause: errWithoutStack,

packages/core/src/test/shared/awsClientBuilderV3.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('AwsClientBuilderV3', function () {
244244
await telemetry.vscode_executeCommand.run(async (_span) => {
245245
await assert.rejects(onDeserialize(next, context, args))
246246
})
247-
assertLogsContain('test error', false, 'error')
247+
assertLogsContain('test error', false, 'warn')
248248
assertTelemetry('vscode_executeCommand', { requestServiceType: 'foo' })
249249
})
250250

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.only('Test how this codebase uses the CodeCatalyst API', function () {
91+
describe('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)