fix: call handlers without callbacks
This commit is contained in:
parent
6613291977
commit
eb973e0f83
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user