Ignore errors thrown by listeners

This commit is contained in:
2026-08-10 02:32:28 +00:00
parent ef797a5f20
commit 95dc998b93
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.