Skip to content

feat(content): add DropEvent error handler #6446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/connections/functions/insert-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ You can `throw` the following pre-defined error types to indicate that the funct
- `InvalidEventPayload`
- `ValidationError`
- `RetryError`
- `DropEvent`

The examples show basic uses of these error types.

Expand Down Expand Up @@ -156,6 +157,14 @@ async function onTrack(event) {
}
}

async function onIdentify(event) {
if (event.traits.companyName) {
// Drop Event | Do NOT forward event to destination
throw new DropEvent('Company name is required')
}
return event;
}

```
If you don't supply a function for an event type, Segment throws an `EventNotSupported` error by default.

Expand Down
Loading