Skip to content

Commit

Permalink
chore: log when we fail to normalize the event or parse the timestamp (
Browse files Browse the repository at this point in the history
  • Loading branch information
tiina303 authored Sep 26, 2023
1 parent 4133504 commit 6b3dd0a
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { PluginEvent } from '@posthog/plugin-scaffold'
import { DateTime } from 'luxon'
import { Person } from 'types'

import { normalizeEvent } from '../../../utils/event'
import { status } from '../../../utils/status'
import { PersonState } from '../person-state'
import { parseEventTimestamp } from '../timestamps'
import { EventPipelineRunner } from './runner'
Expand All @@ -10,9 +12,15 @@ export async function processPersonsStep(
runner: EventPipelineRunner,
pluginEvent: PluginEvent
): Promise<[PluginEvent, Person]> {
const event = normalizeEvent(pluginEvent)

const timestamp = parseEventTimestamp(event)
let event: PluginEvent
let timestamp: DateTime
try {
event = normalizeEvent(pluginEvent)
timestamp = parseEventTimestamp(event)
} catch (error) {
status.warn('⚠️', 'Failed normalizing event', { team_id: pluginEvent.team_id, uuid: pluginEvent.uuid, error })
throw error
}

const person = await new PersonState(
event,
Expand Down

0 comments on commit 6b3dd0a

Please sign in to comment.