From 9fca546745813a44e1c29ac78dff37c8540e4921 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Thu, 17 Jul 2025 16:03:01 -0700 Subject: [PATCH] alert on ws 1002 error (#1472) ## Description: Alert the error when a user is unauthorized to join a game. Previously it would just log an error and the user would have no idea why they couldn't join a game (if for example they were using a restricted pattern). Now the user gets an alert. We should make this a proper modal in the future. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I have read and accepted the CLA aggreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: evan --- src/client/Transport.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/Transport.ts b/src/client/Transport.ts index 71cece02b..dee57fc2b 100644 --- a/src/client/Transport.ts +++ b/src/client/Transport.ts @@ -342,7 +342,10 @@ export class Transport { console.log( `WebSocket closed. Code: ${event.code}, Reason: ${event.reason}`, ); - if (event.code !== 1000 && event.code !== 1002) { + if (event.code === 1002) { + // TODO: make this a modal + alert(`connection refused: ${event.reason}`); + } else if (event.code !== 1000) { console.log(`recieved error code ${event.code}, reconnecting`); this.reconnect(); }