Skip to content

Commit e5d774b

Browse files
committed
Fixes error logging args
1 parent 4a1c96c commit e5d774b

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

src/plus/gk/account/organizationService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export class OrganizationService implements Disposable {
7979

8080
if (!rsp.ok) {
8181
debugger;
82-
Logger.error('', scope, `Unable to get organizations; status=(${rsp.status}): ${rsp.statusText}`);
82+
Logger.error(
83+
undefined,
84+
scope,
85+
`Unable to get organizations; status=(${rsp.status}): ${rsp.statusText}`,
86+
);
8387

8488
void window.showErrorMessage(`Unable to get organizations; Status: ${rsp.statusText}`, 'OK');
8589

src/plus/gk/account/subscriptionService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ export class SubscriptionService implements Disposable {
14991499
}
15001500

15011501
if (code == null) {
1502-
Logger.error(`No code provided. Link: ${uri.toString(true)}`, scope);
1502+
Logger.error(undefined, scope, `No code provided. Link: ${uri.toString(true)}`);
15031503
void window.showErrorMessage(
15041504
`Unable to ${contextMessage} with that link. Please try clicking the link again. If this issue persists, please contact support.`,
15051505
);

src/plus/integrations/authentication/cloudIntegrationService.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Container } from '../../../container';
22
import { Logger } from '../../../system/logger';
3+
import { getLogScope } from '../../../system/logger.scope';
34
import type { ServerConnection } from '../../gk/serverConnection';
45
import type { IntegrationId } from '../providers/models';
56
import type { CloudIntegrationAuthenticationSession, CloudIntegrationConnection } from './models';
@@ -12,6 +13,8 @@ export class CloudIntegrationService {
1213
) {}
1314

1415
async getConnections(): Promise<CloudIntegrationConnection[] | undefined> {
16+
const scope = getLogScope();
17+
1518
const providersRsp = await this.connection.fetchGkDevApi(
1619
'v1/provider-tokens',
1720
{ method: 'GET' },
@@ -22,7 +25,7 @@ export class CloudIntegrationService {
2225
const errorMessage =
2326
typeof error === 'string' ? error : (error?.message as string) ?? providersRsp.statusText;
2427
if (error != null) {
25-
Logger.error(`Failed to get connected providers from cloud: ${errorMessage}`);
28+
Logger.error(undefined, scope, `Failed to get connected providers from cloud: ${errorMessage}`);
2629
}
2730
if (this.container.telemetry.enabled) {
2831
this.container.telemetry.sendEvent('cloudIntegrations/getConnections/failed', {
@@ -39,10 +42,12 @@ export class CloudIntegrationService {
3942
id: IntegrationId,
4043
refreshToken?: string,
4144
): Promise<CloudIntegrationAuthenticationSession | undefined> {
45+
const scope = getLogScope();
46+
4247
const refresh = Boolean(refreshToken);
4348
const cloudIntegrationType = toCloudIntegrationType[id];
4449
if (cloudIntegrationType == null) {
45-
Logger.error(`Unsupported cloud integration type: ${id}`);
50+
Logger.error(undefined, scope, `Unsupported cloud integration type: ${id}`);
4651
return undefined;
4752
}
4853
const reqInitOptions = refreshToken
@@ -63,7 +68,11 @@ export class CloudIntegrationService {
6368
const error = (await tokenRsp.json())?.error;
6469
const errorMessage = typeof error === 'string' ? error : (error?.message as string) ?? tokenRsp.statusText;
6570
if (error != null) {
66-
Logger.error(`Failed to ${refresh ? 'refresh' : 'get'} ${id} token from cloud: ${errorMessage}`);
71+
Logger.error(
72+
undefined,
73+
scope,
74+
`Failed to ${refresh ? 'refresh' : 'get'} ${id} token from cloud: ${errorMessage}`,
75+
);
6776
}
6877
if (this.container.telemetry.enabled) {
6978
this.container.telemetry.sendEvent(

src/plus/integrations/integrationService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ export class IntegrationService implements Disposable {
225225
for (const integrationId of integrationIds) {
226226
const cloudIntegrationType = toCloudIntegrationType[integrationId];
227227
if (cloudIntegrationType == null) {
228-
Logger.error(`Attempting to connect unsupported cloud integration type: ${integrationId}`);
228+
Logger.error(
229+
undefined,
230+
scope,
231+
`Attempting to connect unsupported cloud integration type: ${integrationId}`,
232+
);
229233
} else {
230234
cloudIntegrationTypes.push(cloudIntegrationType);
231235
}

src/system/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ export const defaultLogProvider: LogProvider = {
326326
log: (logLevel: LogLevel, scope: LogScope | undefined, message: string, ...params: any[]) => {
327327
switch (logLevel) {
328328
case 'error':
329-
Logger.error('', scope, message, ...params);
329+
Logger.error(undefined, scope, message, ...params);
330330
break;
331331
case 'warn':
332332
Logger.warn(scope, message, ...params);

0 commit comments

Comments
 (0)