fix: call handlers without callbacks

This commit is contained in:
James Murdza 2024-10-25 19:02:18 -06:00
parent 6613291977
commit eb973e0f83

View File

@ -124,7 +124,8 @@ io.on("connection", async (socket) => {
Object.entries(sandboxManager.handlers()).forEach(([event, handler]) => { Object.entries(sandboxManager.handlers()).forEach(([event, handler]) => {
socket.on(event, async (options: any, callback?: (response: any) => void) => { socket.on(event, async (options: any, callback?: (response: any) => void) => {
try { try {
callback?.(await handler(options)); const result = await handler(options)
callback?.(result);
} catch (e: any) { } catch (e: any) {
handleErrors(`Error processing event "${event}":`, e, socket); handleErrors(`Error processing event "${event}":`, e, socket);
} }