From 88dc83ed6f2433b825ad78648ace93f84f494ffc Mon Sep 17 00:00:00 2001 From: olav Date: Tue, 28 Jun 2022 16:13:25 +0200 Subject: [PATCH] refactor: log event type when an event can't be saved (#1763) * refactor: log event type when an event can't be saved * Update src/lib/db/event-store.ts Co-authored-by: Thomas Heartman Co-authored-by: Thomas Heartman --- src/lib/db/event-store.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/db/event-store.ts b/src/lib/db/event-store.ts index 6bf9e2ef76..2f70e1d21b 100644 --- a/src/lib/db/event-store.ts +++ b/src/lib/db/event-store.ts @@ -51,8 +51,8 @@ class EventStore extends EventEmitter implements IEventStore { .returning(EVENT_COLUMNS); const savedEvent = this.rowToEvent(rows[0]); process.nextTick(() => this.emit(event.type, savedEvent)); - } catch (e) { - this.logger.warn(`Failed to store event ${e}`); + } catch (error: unknown) { + this.logger.warn(`Failed to store "${event.type}" event: ${error}`); } } @@ -65,8 +65,8 @@ class EventStore extends EventEmitter implements IEventStore { process.nextTick(() => savedEvents.forEach((e) => this.emit(e.type, e)), ); - } catch (e) { - this.logger.warn('Failed to store events'); + } catch (error: unknown) { + this.logger.warn(`Failed to store events: ${error}`); } }