summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorParty Wumpus <48649272+PartyWumpus@users.noreply.github.com>2024-02-16 13:29:24 +0000
committerParty Wumpus <48649272+PartyWumpus@users.noreply.github.com>2024-02-16 13:35:08 +0000
commit61b984bfa1afe3b50a1b910c114c5855c3a0100a (patch)
tree72c0182d080edbc70e3682d2b26ae8fb7fb563e3 /frontend
parent867ce63f7bc67cb418d96d226a7e3eaf2b05bc87 (diff)
downloaddecky-loader-61b984bfa1afe3b50a1b910c114c5855c3a0100a.tar.gz
decky-loader-61b984bfa1afe3b50a1b910c114c5855c3a0100a.zip
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
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/wsrouter.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/frontend/src/wsrouter.ts b/frontend/src/wsrouter.ts
index aada457c..b3961125 100644
--- a/frontend/src/wsrouter.ts
+++ b/frontend/src/wsrouter.ts
@@ -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`);