feat: add error handling for game actions in GameManager and update service worker revision for index.html.
This commit is contained in:
@@ -82,7 +82,7 @@ define(['./workbox-5a5d9309'], (function (workbox) { 'use strict';
|
||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||
}, {
|
||||
"url": "index.html",
|
||||
"revision": "0.99c1h4jant"
|
||||
"revision": "0.r2hp08ujhtk"
|
||||
}], {});
|
||||
workbox.cleanupOutdatedCaches();
|
||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||
|
||||
@@ -366,6 +366,7 @@ export class GameManager extends EventEmitter {
|
||||
|
||||
console.log(`[GameManager] Handling Action: ${action.type} for ${roomId} by ${actorId}`);
|
||||
|
||||
try {
|
||||
switch (action.type) {
|
||||
case 'UPDATE_LIFE':
|
||||
if (game.players[actorId]) {
|
||||
@@ -386,6 +387,11 @@ export class GameManager extends EventEmitter {
|
||||
this.restartGame(roomId);
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user