Skip to content

Commit

Permalink
chore: small fix for undefined userDefinedTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Feb 12, 2024
1 parent 8c467c2 commit 3d370db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/v0/destinations/am/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ const processSingleMessage = (message, destination) => {
case EventType.PAGE:
if (useUserDefinedPageEventName) {
const getMessagePath = userProvidedPageEventString
.substring(
?.substring(
userProvidedPageEventString.indexOf('{') + 2,
userProvidedPageEventString.indexOf('}'),
)
Expand All @@ -624,7 +624,7 @@ const processSingleMessage = (message, destination) => {
userProvidedPageEventString.trim() === ''
? name
: userProvidedPageEventString
.trim()
?.trim()
.replaceAll(/{{([^{}]+)}}/g, get(message, getMessagePath));
} else {
evType = `Viewed ${name || get(message, CATEGORY_KEY) || ''} Page`;
Expand Down Expand Up @@ -705,7 +705,7 @@ const processSingleMessage = (message, destination) => {
// putting a check for evType as there some cases like page name is not present and teamplte depends on page name only.
if (!isDefinedAndNotNull(evType)) {
throw new InstrumentationError(
'Event type not present. Please send event type. If you are sending page/screen call, please provide the name',
'Event type not present. If you are sending page/screen call with custom name, please provide the name',
);
}
return responseBuilderSimple(
Expand Down
4 changes: 2 additions & 2 deletions test/integrations/destinations/am/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11352,7 +11352,7 @@ export const data = [
Config: {
apiKey: 'abcde',
useUserDefinedPageEventName: true,
userProvidedPageEventString: undefined,
userProvidedPageEventString: '',
},
},
},
Expand All @@ -11366,7 +11366,7 @@ export const data = [
{
statusCode: 400,
error:
'Event type not present. Please send event type. If you are sending page/screen call, please provide the name',
'Event type not present. If you are sending page/screen call with custom name, please provide the name',
statTags: {
errorCategory: 'dataValidation',
errorType: 'instrumentation',
Expand Down

0 comments on commit 3d370db

Please sign in to comment.