[#317] improved event error management + test (#358)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-11-25 15:46:30 +01:00
committed by GitHub
parent 9151ff5563
commit d8c931e02e
3 changed files with 115 additions and 5 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
export class EventErrorHandler {
private errors = new Map<string, string>();
private reportedEvents = new Set<string>();
private onErrorCallback?: (messages: string[]) => void;
setErrorCallback(callback: (messages: string[]) => void) {
@@ -7,7 +8,8 @@ export class EventErrorHandler {
}
reportError(eventId: string, message: string) {
if (!this.errors.has(eventId)) {
if (!this.reportedEvents.has(eventId)) {
this.reportedEvents.add(eventId);
this.errors.set(eventId, message);
console.warn(`[EventErrorHandler] ${eventId}: ${message}`);
this.emit();