Skip to content

Commit

Permalink
fix(internal-plugin-metrics): restricted region wdm error marked as e…
Browse files Browse the repository at this point in the history
…xpected (webex#3897)
  • Loading branch information
jor-row authored Oct 9, 2024
1 parent d78f855 commit 3abb5c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const ERROR_DESCRIPTIONS = {
ICE_AND_REACHABILITY_FAILED: 'ICEAndReachabilityFailed',
SDP_OFFER_CREATION_ERROR: 'SdpOfferCreationError',
SDP_OFFER_CREATION_ERROR_MISSING_CODEC: 'SdpOfferCreationErrorMissingCodec',
WDM_RESTRICTED_REGION: 'WdmRestrictedRegion',
};

export const SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP = {
Expand Down Expand Up @@ -288,6 +289,12 @@ export const SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP = {
100005: 4103, // Depracated because of an issue in the UCF Clients
// If both email-hash and domain-hash are null or undefined.
100004: 4103,

// ---- WDM ----
// WDM_BLOCKED_ACCESS_BY_COUNTRY_CODE_BANNED_COUNTRY_ERROR_CODE
4404002: 13000,
// WDM_BLOCKED_ACCESS_BY_COUNTRY_CODE_RESTRICTED_COUNTRY_ERROR_CODE
4404003: 13000,
};

export const CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD: Record<number, Partial<ClientEventError>> = {
Expand Down Expand Up @@ -687,6 +694,11 @@ export const CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD: Record<number, Partial<ClientEv
category: 'expected',
fatal: true,
},
13000: {
errorDescription: ERROR_DESCRIPTIONS.WDM_RESTRICTED_REGION,
category: 'expected',
fatal: true,
},
};

export const CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND = 'js_sdk_call_diagnostic_event_failed_to_send';
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,40 @@ describe('internal-plugin-metrics', () => {
});
});

it('should generate event error payload correctly for wdm error 4404002', () => {
const res = cd.generateClientEventErrorPayload({
body: {errorCode: 4404002},
message: 'Operation denied due to region restriction',
});
assert.deepEqual(res, {
category: 'expected',
errorDescription: 'WdmRestrictedRegion',
fatal: true,
name: 'other',
shownToUser: false,
serviceErrorCode: 4404002,
errorCode: 13000,
rawErrorMessage: 'Operation denied due to region restriction',
});
});

it('should generate event error payload correctly for wdm error 4404003', () => {
const res = cd.generateClientEventErrorPayload({
body: {errorCode: 4404003},
message: 'Operation denied due to region restriction',
});
assert.deepEqual(res, {
category: 'expected',
errorDescription: 'WdmRestrictedRegion',
fatal: true,
name: 'other',
shownToUser: false,
serviceErrorCode: 4404003,
errorCode: 13000,
rawErrorMessage: 'Operation denied due to region restriction',
});
});

describe('httpStatusCode', () => {
it('should include httpStatusCode for browser media errors', () => {
const res = cd.generateClientEventErrorPayload({
Expand Down

0 comments on commit 3abb5c9

Please sign in to comment.