From 90c725e3ecd6c4476d66a54b84f34e0f4a7b205c Mon Sep 17 00:00:00 2001 From: Sankeerth Date: Wed, 13 Dec 2023 13:17:09 +0530 Subject: [PATCH] fix: braze transformation error due to wrong import (#2901) --- src/v0/util/errorTypes/filteredEventsError.js | 2 +- src/v0/util/errorTypes/transformerProxyError.js | 2 +- src/v0/util/index.js | 2 +- src/v0/util/index.test.js | 10 ++++++++++ test/__tests__/data/braze_router.json | 4 +--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/v0/util/errorTypes/filteredEventsError.js b/src/v0/util/errorTypes/filteredEventsError.js index cb0236f342..990ca76670 100644 --- a/src/v0/util/errorTypes/filteredEventsError.js +++ b/src/v0/util/errorTypes/filteredEventsError.js @@ -1,4 +1,4 @@ -const { BaseError } = require('./base'); +const { BaseError } = require('@rudderstack/integrations-lib'); const { HTTP_STATUS_CODES } = require('../constant'); class FilteredEventsError extends BaseError { diff --git a/src/v0/util/errorTypes/transformerProxyError.js b/src/v0/util/errorTypes/transformerProxyError.js index 42ccdea490..2fefb6fb92 100644 --- a/src/v0/util/errorTypes/transformerProxyError.js +++ b/src/v0/util/errorTypes/transformerProxyError.js @@ -1,5 +1,5 @@ +const { BaseError } = require('@rudderstack/integrations-lib'); const tags = require('../tags'); -const { BaseError } = require('./base'); const errorTypes = Object.values(tags.ERROR_TYPES); const metaTypes = Object.values(tags.METADATA); diff --git a/src/v0/util/index.js b/src/v0/util/index.js index fee1d7a96d..34182a7685 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -83,7 +83,7 @@ const isPrimitive = (arg) => { const isNewStatusCodesAccepted = (reqMetadata = {}) => { if (reqMetadata && typeof reqMetadata === 'object' && !Array.isArray(reqMetadata)) { const { features } = reqMetadata; - return !!(features && features[FEATURE_FILTER_CODE]); + return !!features?.[FEATURE_FILTER_CODE]; } return false; }; diff --git a/src/v0/util/index.test.js b/src/v0/util/index.test.js index e39c583aab..65d6313e30 100644 --- a/src/v0/util/index.test.js +++ b/src/v0/util/index.test.js @@ -1,5 +1,7 @@ +const { TAG_NAMES } = require('@rudderstack/integrations-lib'); const utilities = require('.'); const { getFuncTestData } = require('../../../test/testHelper'); +const { FilteredEventsError } = require('./errorTypes'); const { hasCircularReference, flattenJson } = require('./index'); // Names of the utility functions to test @@ -116,3 +118,11 @@ describe('flattenJson', () => { ); }); }); + +describe('tests for generateErrorObject', () => { + test('test-0', () => { + const myErr = new FilteredEventsError('error-1'); + const outputErrObj = utilities.generateErrorObject(myErr); + expect(outputErrObj.statTags).toEqual({}); + }); +}); diff --git a/test/__tests__/data/braze_router.json b/test/__tests__/data/braze_router.json index 8bfd7c7d42..33c66bca6d 100644 --- a/test/__tests__/data/braze_router.json +++ b/test/__tests__/data/braze_router.json @@ -841,9 +841,7 @@ }, { "error": "[Braze Deduplication]: Duplicate user detected, the user is dropped", - "statTags": { - "errorCategory": "transformation" - }, + "statTags": {}, "statusCode": 298, "batched": false, "metadata": [