Skip to content

Commit bc22aa6

Browse files
committed
Updates from PM review [netlify-build]
1 parent f71505f commit bc22aa6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/_includes/content/functions/logs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
If your function throws an error, execution halts immediately. Segment captures the event, any outgoing requests/responses, any logs the function might have printed, as well as the error itself.
22

3-
Segment then displays the captured error information in the [Event Delivery](/docs/connections/event-delivery/) page for your function. You can use this information to find and fix unexpected errors.
3+
Segment then displays the captured error information in the [Event Delivery](/docs/connections/event-delivery/) page for your destination. You can use this information to find and fix unexpected errors.
44

55
You can throw [an error or a custom error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error){:target="_blank"} and you can also add helpful context in logs using the [`console` API](https://developer.mozilla.org/en-US/docs/Web/API/console){:target="_blank"}. For example:
66

src/connections/functions/insert-functions.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ To create a batch handler, define an `onBatch` function within your destination
261261
```js
262262
async function onBatch(events, settings){
263263
// handle the batch of events
264+
return events
264265
}
265266
```
266267

@@ -326,15 +327,23 @@ async function onBatch(events, settings) {
326327
// ...handle other event types here...
327328
}
328329
})
329-
return Promise.all(promises)
330+
try {
331+
const results = await Promise.all(promises);
332+
const batchResult = [].concat(...results); // Combine arrays into a single array
333+
return batchResult;
334+
} catch (error) {
335+
throw new RetryError(error.message);
336+
}
330337
}
331338

332339
async function onTrackBatch(events, settings) {
333340
// handle a batch of track events
341+
return events
334342
}
335343

336344
async function onIdentifyBatch(events, settings) {
337345
// handle a batch of identify events
346+
return events
338347
}
339348
```
340349

0 commit comments

Comments
 (0)