diff --git a/back/src/Controller/DebugController.ts b/back/src/Controller/DebugController.ts index 160a2342..8fbf82e4 100644 --- a/back/src/Controller/DebugController.ts +++ b/back/src/Controller/DebugController.ts @@ -23,35 +23,37 @@ export class DebugController { .writeStatus("200 OK") .writeHeader("Content-Type", "application/json") .end( - stringify(await Promise.all(socketManager.getWorlds().values()), (key: unknown, value: unknown) => { - if (key === "listeners") { - return "Listeners"; - } - if (key === "socket") { - return "Socket"; - } - if (key === "batchedMessages") { - return "BatchedMessages"; - } - if (value instanceof Map) { - const obj: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any - for (const [mapKey, mapValue] of value.entries()) { - obj[mapKey] = mapValue; + stringify( + await Promise.all(socketManager.getWorlds().values()), + (key: unknown, value: unknown) => { + if (key === "listeners") { + return "Listeners"; } - return obj; - } else if (value instanceof Set) { - const obj: Array = []; - for (const [setKey, setValue] of value.entries()) { - obj.push(setValue); + if (key === "socket") { + return "Socket"; + } + if (key === "batchedMessages") { + return "BatchedMessages"; + } + if (value instanceof Map) { + const obj: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any + for (const [mapKey, mapValue] of value.entries()) { + obj[mapKey] = mapValue; + } + return obj; + } else if (value instanceof Set) { + const obj: Array = []; + for (const [setKey, setValue] of value.entries()) { + obj.push(setValue); + } + return obj; + } else { + return value; } - return obj; - } else { - return value; } - }) + ) ); - - })().catch(e => { + })().catch((e) => { console.error(e); res.writeStatus("500"); res.end("An error occurred");