Skip to content

Commit

Permalink
fix: adding logger for undefined source event (#3879)
Browse files Browse the repository at this point in the history
* fix: adding logger for undefined source event

* fix: review comment addressed

* chore: enrich metadata, update error msg in logger

* chore: code review updates

---------

Co-authored-by: Sai Sankeerth <sanpj2292@github.com>
  • Loading branch information
shrouti1507 and Sai Sankeerth authored Nov 18, 2024
1 parent 74fab0e commit 79e5979
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controllers/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export class SourceController {
const requestMetadata = MiscService.getRequestMetadata(ctx);
const events = ctx.request.body as object[];
const { version, source }: { version: string; source: string } = ctx.params;
const enrichedMetadata = {
...requestMetadata,
source,
version,
};
const integrationService = ServiceSelector.getNativeSourceService();

try {
Expand All @@ -28,6 +33,7 @@ export class SourceController {
);
ctx.body = resplist;
} catch (err: any) {
logger.error(err?.message || 'error in source transformation', enrichedMetadata);
const metaTO = integrationService.getTags();
const resp = SourcePostTransformationService.handleFailureEventsSource(err, metaTO);
ctx.body = [resp];
Expand Down

0 comments on commit 79e5979

Please sign in to comment.