mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 04:05:04 +03:00
what if the error handling worked for async event listeners
the anonymous async function is made so the event handlers can each be started in parallel, just in case there's a long running function
This commit is contained in:
@@ -158,11 +158,13 @@ export class WSRouter extends Logger {
|
||||
case MessageType.EVENT:
|
||||
if (this.eventListeners.has(data.event)) {
|
||||
for (const listener of this.eventListeners.get(data.event)!) {
|
||||
try {
|
||||
listener(...data.args);
|
||||
} catch (e) {
|
||||
this.error(`error in event ${data.event}`, e, listener);
|
||||
}
|
||||
(async () => {
|
||||
try {
|
||||
await listener(...data.args);
|
||||
} catch (e) {
|
||||
this.error(`error in event ${data.event}`, e, listener);
|
||||
}
|
||||
})();
|
||||
}
|
||||
} else {
|
||||
this.debug(`event ${data.event} has no listeners`);
|
||||
|
||||
Reference in New Issue
Block a user