1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

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 <thomas@getunleash.ai>

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
This commit is contained in:
olav 2022-06-28 16:13:25 +02:00 committed by GitHub
parent 5d5fc37dfd
commit 88dc83ed6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}`);
}
}