File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
plus/integrations/authentication Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -1280,6 +1280,23 @@ export type TelemetryEvents = {
12801280 'integration.connected.ids' : string | undefined ;
12811281 } ;
12821282
1283+ /** Sent when getting connected providers from the api fails*/
1284+ 'cloudIntegrations/getConnections/failed' : {
1285+ code : number | undefined ;
1286+ } ;
1287+
1288+ /** Sent when getting a provider token from the api fails*/
1289+ 'cloudIntegrations/getConnection/failed' : {
1290+ code : number | undefined ;
1291+ 'integration.id' : string | undefined ;
1292+ } ;
1293+
1294+ /** Sent when refreshing a provider token from the api fails*/
1295+ 'cloudIntegrations/refreshConnection/failed' : {
1296+ code : number | undefined ;
1297+ 'integration.id' : string | undefined ;
1298+ } ;
1299+
12831300 /** Sent when a cloud-based hosting provider is connected */
12841301 'cloudIntegrations/hosting/connected' : {
12851302 'hostingProvider.provider' : IntegrationId ;
Original file line number Diff line number Diff line change @@ -19,8 +19,15 @@ export class CloudIntegrationService {
1919 ) ;
2020 if ( ! providersRsp . ok ) {
2121 const error = ( await providersRsp . json ( ) ) ?. error ;
22+ const errorMessage =
23+ typeof error === 'string' ? error : ( error ?. message as string ) ?? providersRsp . statusText ;
2224 if ( error != null ) {
23- Logger . error ( `Failed to get connected providers from cloud: ${ error . message } ` ) ;
25+ Logger . error ( `Failed to get connected providers from cloud: ${ errorMessage } ` ) ;
26+ }
27+ if ( this . container . telemetry . enabled ) {
28+ this . container . telemetry . sendEvent ( 'cloudIntegrations/getConnections/failed' , {
29+ code : providersRsp . status ,
30+ } ) ;
2431 }
2532 return undefined ;
2633 }
@@ -54,8 +61,20 @@ export class CloudIntegrationService {
5461 ) ;
5562 if ( ! tokenRsp . ok ) {
5663 const error = ( await tokenRsp . json ( ) ) ?. error ;
64+ const errorMessage = typeof error === 'string' ? error : ( error ?. message as string ) ?? tokenRsp . statusText ;
5765 if ( error != null ) {
58- Logger . error ( `Failed to ${ refresh ? 'refresh' : 'get' } ${ id } token from cloud: ${ error . message } ` ) ;
66+ Logger . error ( `Failed to ${ refresh ? 'refresh' : 'get' } ${ id } token from cloud: ${ errorMessage } ` ) ;
67+ }
68+ if ( this . container . telemetry . enabled ) {
69+ this . container . telemetry . sendEvent (
70+ refreshToken
71+ ? 'cloudIntegrations/refreshConnection/failed'
72+ : 'cloudIntegrations/getConnection/failed' ,
73+ {
74+ code : tokenRsp . status ,
75+ 'integration.id' : id ,
76+ } ,
77+ ) ;
5978 }
6079 return undefined ;
6180 }
You can’t perform that action at this time.
0 commit comments