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
This commit is contained in:
evanpelle
2025-08-20 15:16:41 -07:00
committed by GitHub
parent 4ba9b3b6b3
commit 028a44947f
+5 -2
View File
@@ -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(