From d842da87a34cb63023eba288e0c5258e29997dcf Mon Sep 17 00:00:00 2001 From: Manish Kumar <144022547+manish339k@users.noreply.github.com> Date: Thu, 23 May 2024 11:40:05 +0530 Subject: [PATCH] feat: filtering unknown events in awin (#3392) * feat: filtering unknown events in awin * fix: apply suggestions from code review Co-authored-by: Gauravudia <60897972+Gauravudia@users.noreply.github.com> --------- Co-authored-by: Gauravudia <60897972+Gauravudia@users.noreply.github.com> --- src/v0/destinations/awin/transform.js | 7 ++++--- test/integrations/destinations/awin/data.ts | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/v0/destinations/awin/transform.js b/src/v0/destinations/awin/transform.js index 68dd9d62e1..0e1e220548 100644 --- a/src/v0/destinations/awin/transform.js +++ b/src/v0/destinations/awin/transform.js @@ -3,6 +3,7 @@ const { BASE_URL, ConfigCategory, mappingConfig } = require('./config'); const { defaultRequestConfig, constructPayload, simpleProcessRouterDest } = require('../../util'); const { getParams, trackProduct, populateCustomTransactionProperties } = require('./utils'); +const { FilteredEventsError } = require('../../util/errorTypes'); const responseBuilder = (message, { Config }) => { const { advertiserId, eventsToTrack, customFieldMap } = Config; @@ -33,9 +34,9 @@ const responseBuilder = (message, { Config }) => { ...customTransactionProperties, }; } else { - throw new InstrumentationError( - "Event is not present in 'Events to Track' list. Aborting message.", - 400, + throw new FilteredEventsError( + "Event is not present in 'Events to Track' list. Dropping the event.", + 298, ); } } diff --git a/test/integrations/destinations/awin/data.ts b/test/integrations/destinations/awin/data.ts index 5a7fcfb50f..821b55637e 100644 --- a/test/integrations/destinations/awin/data.ts +++ b/test/integrations/destinations/awin/data.ts @@ -828,16 +828,14 @@ export const data = [ status: 200, body: [ { - error: "Event is not present in 'Events to Track' list. Aborting message.", + error: "Event is not present in 'Events to Track' list. Dropping the event.", statTags: { destType: 'AWIN', - errorCategory: 'dataValidation', - errorType: 'instrumentation', feature: 'processor', implementation: 'native', module: 'destination', }, - statusCode: 400, + statusCode: 298, }, ], },