Skip to content

Commit ed23808

Browse files
MichaelGHSegclaude
andcommitted
Wire error event listener in e2e-cli for failure reporting
Add analytics.on('error') handler to capture delivery failures. Reports success=false with the first error reason when any batch fails (non-retryable error or retries exhausted). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5a99827 commit ed23808

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • packages/node/e2e-cli/src

packages/node/e2e-cli/src/cli.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ async function main(): Promise<void> {
141141
httpRequestTimeout: config.timeout ?? 10000,
142142
})
143143

144+
const deliveryErrors: string[] = []
145+
analytics.on('error', (err) => {
146+
const reason = err.reason
147+
const msg =
148+
reason instanceof Error ? reason.message : String(reason ?? err.code)
149+
deliveryErrors.push(msg)
150+
})
151+
144152
// Process event sequences
145153
for (const seq of sequences) {
146154
if (seq.delayMs > 0) {
@@ -155,8 +163,13 @@ async function main(): Promise<void> {
155163
// Flush and close
156164
await analytics.closeAndFlush()
157165

158-
output.success = true
159-
output.sentBatches = 1 // Placeholder
166+
if (deliveryErrors.length > 0) {
167+
output.success = false
168+
output.error = deliveryErrors[0]
169+
} else {
170+
output.success = true
171+
output.sentBatches = 1
172+
}
160173
} catch (err) {
161174
output.error = err instanceof Error ? err.message : String(err)
162175
}

0 commit comments

Comments
 (0)