mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-28 06:54:20 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user