mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:30:45 +00:00
Pot issue fix (#1233)
## Description: Fixes #1232 Fixes #1231 Add handle's ## 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 understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: dovg
This commit is contained in:
@@ -92,7 +92,14 @@ export class LocalServer {
|
||||
}
|
||||
|
||||
onMessage(message: string) {
|
||||
const result = ClientMessageSchema.safeParse(JSON.parse(message));
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(message);
|
||||
} catch (e) {
|
||||
console.error("Failed to parse client message:", e);
|
||||
return;
|
||||
}
|
||||
const result = ClientMessageSchema.safeParse(parsed);
|
||||
if (!result.success) {
|
||||
const error = z.prettifyError(result.error);
|
||||
console.error("Error parsing client message", error);
|
||||
|
||||
@@ -310,7 +310,14 @@ export class Transport {
|
||||
onconnect();
|
||||
};
|
||||
this.socket.onmessage = (event: MessageEvent) => {
|
||||
const result = ServerMessageSchema.safeParse(JSON.parse(event.data));
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(event.data);
|
||||
} catch (e) {
|
||||
console.error("Failed to parse server message:", e, event.data);
|
||||
return;
|
||||
}
|
||||
const result = ServerMessageSchema.safeParse(parsed);
|
||||
if (!result.success) {
|
||||
const error = z.prettifyError(result.error);
|
||||
console.error("Error parsing server message", error);
|
||||
|
||||
Reference in New Issue
Block a user