diff --git a/packages/js/src/batch.ts b/packages/js/src/batch.ts index c828e61..860a4e4 100644 --- a/packages/js/src/batch.ts +++ b/packages/js/src/batch.ts @@ -58,8 +58,15 @@ export class Batch { return; } - const res = await this.ingestFn(this.id, events, this.options); - this.lastFlush = new Date(); + let res = null; + try { + res = await this.ingestFn(this.id, events, this.options); + } catch (e) { + throw e; + } finally { + this.lastFlush = new Date(); + } + return res; }; }