From 028a44947fa841e3277b11be8cb9789a4f861351 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 20 Aug 2025 15:16:41 -0700 Subject: [PATCH] Send error to client if server cannot get pattern (#1861) ## Description: If the server is unable to fetch cosmetics.json, then it cannot get the pattern, so close the connection with error. This scenario is unlikely to happen, because if the api is down, users can't log in anyways. ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: evan --- src/server/Worker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/Worker.ts b/src/server/Worker.ts index b8b7aa909..d16da80fb 100644 --- a/src/server/Worker.ts +++ b/src/server/Worker.ts @@ -422,9 +422,12 @@ export async function startWorker() { pattern = result.pattern; break; case "unknown": - // Api could be down, so allow player to join but disable pattern. log.warn(`Pattern ${clientMsg.patternName} unknown`); - break; + ws.close( + 1002, + "Could not look up pattern, backend may be offline", + ); + return; case "forbidden": log.warn(`Pattern ${clientMsg.patternName}: ${result.reason}`); ws.close(