Skip to content

Commit 34ca1f5

Browse files
Merge pull request #6446 from segmentio/feat/add-dropevent-error-handler
feat(content): add `DropEvent` error handler
2 parents cc7212a + 06c1b29 commit 34ca1f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/connections/functions/insert-functions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ You can `throw` the following pre-defined error types to indicate that the funct
113113
- `InvalidEventPayload`
114114
- `ValidationError`
115115
- `RetryError`
116+
- `DropEvent`
116117

117118
The examples show basic uses of these error types.
118119

@@ -156,6 +157,14 @@ async function onTrack(event) {
156157
}
157158
}
158159

160+
async function onIdentify(event) {
161+
if (event.traits.companyName) {
162+
// Drop Event | Do NOT forward event to destination
163+
throw new DropEvent('Company name is required')
164+
}
165+
return event;
166+
}
167+
159168
```
160169
If you don't supply a function for an event type, Segment throws an `EventNotSupported` error by default.
161170

0 commit comments

Comments
 (0)