From 1cf5dede99b4267639cee6f64895f15d358e88e3 Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Fri, 24 Jul 2026 04:34:03 +0530 Subject: [PATCH] fix: include actual error message in replaceable event rejection responses --- .changeset/replaceable-event-error-message-empty.md | 11 +++++++++++ .../event-strategies/replaceable-event-strategy.ts | 5 ++++- .../replaceable-event-strategy.spec.ts | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .changeset/replaceable-event-error-message-empty.md diff --git a/.changeset/replaceable-event-error-message-empty.md b/.changeset/replaceable-event-error-message-empty.md new file mode 100644 index 00000000..64bbdaa4 --- /dev/null +++ b/.changeset/replaceable-event-error-message-empty.md @@ -0,0 +1,11 @@ +--- +"nostream": patch +--- + +fix: include the actual error message in replaceable event rejection responses + +`ReplaceableEventStrategy.execute()` sent clients a bare `error: ` command result +(with no message body) whenever `eventRepository.upsert()` failed for a reason other +than a duplicate event id. The underlying `error.message` was caught but never +included in the response, leaving clients with no actionable information about why +the event was rejected. The command result now includes `error.message`. diff --git a/src/handlers/event-strategies/replaceable-event-strategy.ts b/src/handlers/event-strategies/replaceable-event-strategy.ts index d42fc8c0..da060378 100644 --- a/src/handlers/event-strategies/replaceable-event-strategy.ts +++ b/src/handlers/event-strategies/replaceable-event-strategy.ts @@ -32,7 +32,10 @@ export class ReplaceableEventStrategy implements IEventStrategy { }) it('rejects if unable to upsert event', async () => { - const error = new Error() + const error = new Error('connection lost') eventRepositoryUpsertStub.rejects(error) await strategy.execute(event) @@ -98,7 +98,7 @@ describe('ReplaceableEventStrategy', () => { 'OK', 'id', false, - 'error: ', + 'error: connection lost', ]) }) })