Skip to content

Commit

Permalink
fix: braze transformation error due to wrong import (#2901)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpj2292 authored Dec 13, 2023
1 parent be20850 commit 90c725e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/v0/util/errorTypes/filteredEventsError.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { BaseError } = require('./base');
const { BaseError } = require('@rudderstack/integrations-lib');
const { HTTP_STATUS_CODES } = require('../constant');

class FilteredEventsError extends BaseError {
Expand Down
2 changes: 1 addition & 1 deletion src/v0/util/errorTypes/transformerProxyError.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
10 changes: 10 additions & 0 deletions src/v0/util/index.test.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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({});
});
});
4 changes: 1 addition & 3 deletions test/__tests__/data/braze_router.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,7 @@
},
{
"error": "[Braze Deduplication]: Duplicate user detected, the user is dropped",
"statTags": {
"errorCategory": "transformation"
},
"statTags": {},
"statusCode": 298,
"batched": false,
"metadata": [
Expand Down

0 comments on commit 90c725e

Please sign in to comment.