Ignore errors thrown by listeners

This commit is contained in:
2026-08-10 02:04:30 +00:00
parent e782cace36
commit 26602dc156
2 changed files with 24 additions and 1 deletions
+5 -1
View File
@@ -158,7 +158,11 @@ export class EventEmitter<T extends EventMap> {
// Emit the event to all listeners.
listeners.forEach((entry) => {
entry.wrappedListener(readonlyPayload);
try {
entry.wrappedListener(readonlyPayload);
} catch (error) {
console.error(error);
}
});
// Return true if there are listeners for the event, false otherwise.