Skip to content

Commit

Permalink
feat: filtering unknown events in awin (#3392)
Browse files Browse the repository at this point in the history
* feat: filtering unknown events in awin

* fix: apply suggestions from code review

Co-authored-by: Gauravudia <[email protected]>

---------

Co-authored-by: Gauravudia <[email protected]>
  • Loading branch information
manish339k and Gauravudia authored May 23, 2024
1 parent f74c4a0 commit d842da8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/v0/destinations/awin/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
);
}
}
Expand Down
6 changes: 2 additions & 4 deletions test/integrations/destinations/awin/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
},
Expand Down

0 comments on commit d842da8

Please sign in to comment.