feat: add error handling for game actions in GameManager and update service worker revision for index.html.

This commit is contained in:
2025-12-22 23:28:53 +01:00
parent 41be1d49c4
commit 66836cfde5
2 changed files with 26 additions and 20 deletions

View File

@@ -82,7 +82,7 @@ define(['./workbox-5a5d9309'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812" "revision": "3ca0b8505b4bec776b69afdba2768812"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.99c1h4jant" "revision": "0.r2hp08ujhtk"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

View File

@@ -366,6 +366,7 @@ export class GameManager extends EventEmitter {
console.log(`[GameManager] Handling Action: ${action.type} for ${roomId} by ${actorId}`); console.log(`[GameManager] Handling Action: ${action.type} for ${roomId} by ${actorId}`);
try {
switch (action.type) { switch (action.type) {
case 'UPDATE_LIFE': case 'UPDATE_LIFE':
if (game.players[actorId]) { if (game.players[actorId]) {
@@ -386,6 +387,11 @@ export class GameManager extends EventEmitter {
this.restartGame(roomId); this.restartGame(roomId);
break; break;
} }
} catch (e: any) {
console.error(`Legacy Action Error [${action?.type}]: ${e.message}`);
this.emit('game_error', roomId, { message: e.message, userId: actorId });
return null;
}
return game; return game;
} }