add logging para debug del shuffle endpoint
Agrega logging al inicio del endpoint y mejor manejo de errores para diagnosticar por qué está devolviendo HTML en lugar de JSON.
This commit is contained in:
@@ -363,6 +363,8 @@ adminRouter.post("/admin/reset-uuid-profiles", async (req: Request, res: Respons
|
||||
});
|
||||
|
||||
adminRouter.post("/admin/shuffle-players", async (req: Request, res: Response) => {
|
||||
console.log("[AdminAPI] Shuffle endpoint called!");
|
||||
|
||||
try {
|
||||
console.log("[AdminAPI] Starting player shuffle...");
|
||||
|
||||
@@ -518,8 +520,12 @@ adminRouter.post("/admin/shuffle-players", async (req: Request, res: Response) =
|
||||
|
||||
} catch (error) {
|
||||
console.error("[AdminAPI] Error shuffling players:", error);
|
||||
console.error("[AdminAPI] Stack trace:", error instanceof Error ? error.stack : 'No stack trace');
|
||||
NameManager.getInstance().endShuffle(); // Cleanup on error
|
||||
res.status(500).json({ error: "Failed to shuffle players" });
|
||||
|
||||
if (!res.headersSent) {
|
||||
res.status(500).json({ error: "Failed to shuffle players", details: error instanceof Error ? error.message : String(error) });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user