Skip to content

Commit dabc678

Browse files
committed
Fix error report properties not fit server format
1 parent 7b17c3f commit dabc678

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/common/telemetry.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ export function commonSendErrorData(logService: ILogService, defaultGitpodHost:
133133
delete properties['instanceId'];
134134
delete properties['userId'];
135135

136+
// make sure all properties are strings
137+
for (const key in properties) {
138+
if (typeof properties[key] !== 'string') {
139+
properties[key] = JSON.stringify(properties[key]);
140+
}
141+
}
142+
136143
const jsonData = {
137144
component: 'vscode-desktop-extension',
138145
errorStack: errorProps.stack || '',

src/remoteConnector.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { ISessionService } from './services/sessionService';
3838
import { ILogService } from './services/logService';
3939
import { IHostService } from './services/hostService';
4040
import { Configuration } from './configuration';
41-
import { getServiceURL } from './common/utils';
41+
import { WrapError, getServiceURL } from './common/utils';
4242
import { ILocalSSHService } from './services/localSSHService';
4343

4444
interface LocalAppConfig {
@@ -720,9 +720,9 @@ export class RemoteConnector extends Disposable {
720720

721721
this.telemetryService.sendUserFlowStatus('connected', localSSHFlow);
722722
} catch (e) {
723-
const reason = (typeof e?.code === 'string') ? e.code : 'Unknown';
723+
const reason = e?.code ? e.code : 'Unknown';
724724
if (reason === 'Unknown') {
725-
this.telemetryService.sendTelemetryException(e, { ...localSSHFlow });
725+
this.telemetryService.sendTelemetryException(new WrapError('Local SSH: failed to connect to workspace', e, 'Unknown'), { ...localSSHFlow });
726726
}
727727
this.telemetryService.sendUserFlowStatus('failed', { ...localSSHFlow, reason });
728728
this.logService.error(`Local SSH: failed to connect to ${params.workspaceId} Gitpod workspace:`, e);
@@ -748,9 +748,9 @@ export class RemoteConnector extends Disposable {
748748

749749
this.telemetryService.sendUserFlowStatus('connected', gatewayFlow);
750750
} catch (e) {
751-
const reason = (typeof e?.code === 'string') ? e.code : 'Unknown';
751+
const reason = e?.code ? e.code : 'Unknown';
752752
if (reason === 'Unknown') {
753-
this.telemetryService.sendTelemetryException(e, { ...gatewayFlow });
753+
this.telemetryService.sendTelemetryException(new WrapError('Gateway: failed to connect to workspace', e, 'Unknown'), { ...gatewayFlow });
754754
}
755755
this.telemetryService.sendUserFlowStatus('failed', { ...gatewayFlow, reason });
756756
if (e instanceof NoSSHGatewayError) {
@@ -804,9 +804,9 @@ export class RemoteConnector extends Disposable {
804804

805805
this.telemetryService.sendUserFlowStatus('connected', localAppFlow);
806806
} catch (e) {
807-
const reason = (typeof e?.code === 'string') ? e.code : 'Unknown';
807+
const reason = e?.code ? e.code : 'Unknown';
808808
if (reason === 'Unknown') {
809-
this.telemetryService.sendTelemetryException(e, { ...localAppFlow });
809+
this.telemetryService.sendTelemetryException(new WrapError('Local APP: failed to connect to workspace', e, 'Unknown'), { ...localAppFlow });
810810
}
811811
this.telemetryService.sendUserFlowStatus('failed', { reason, ...localAppFlow });
812812
this.logService.error(`Failed to connect ${params.workspaceId} Gitpod workspace:`, e);

0 commit comments

Comments
 (0)