Skip to content

Commit da503bb

Browse files
committed
fix: wrap inline event createEventEnvelope/serializeEnvelope in try/catch
Mirrors the file-based path's error handling — catches any internal SDK errors and re-throws as ValidationError.
1 parent 8cf5df3 commit da503bb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/commands/send-event.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,17 @@ built entirely from the file contents.
298298
);
299299
}
300300
const event = buildEventFromFlags(flags);
301-
const envelope = createEventEnvelope(event, dsnComponents);
302-
await sendEnvelopeRequest(dsn, serializeEnvelope(envelope));
301+
let body: string | Uint8Array;
302+
try {
303+
const envelope = createEventEnvelope(event, dsnComponents);
304+
body = serializeEnvelope(envelope);
305+
} catch (err) {
306+
throw new ValidationError(
307+
`Failed to create event envelope: ${(err as Error).message}`,
308+
"event"
309+
);
310+
}
311+
await sendEnvelopeRequest(dsn, body);
303312
yield new CommandOutput<SendEventResult>({
304313
eventId: event.event_id ?? "",
305314
});

0 commit comments

Comments
 (0)