Skip to content

Commit bd1594b

Browse files
committed
🥅 dont crash on socket client errors #2451
1 parent 1bc07fb commit bd1594b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/cli/server.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,15 @@ export const setupSocketServer : (cliConfig, client : Client) => Promise<void> =
339339
let { args } = objs[0]
340340
if (args && !Array.isArray(args)) args = parseFunction().parse(client[m]).args.map(argName => args[argName]);
341341
else if (!args) args = [];
342-
const data = await client[m](...args)
343-
callbacks[0](data)
342+
try {
343+
const data = await client[m](...args)
344+
callbacks[0](data)
345+
} catch (error) {
346+
callbacks[0]({error: {
347+
message: error.message,
348+
stack: error.stack || ""
349+
}})
350+
}
344351
}
345352
}
346353
return;

0 commit comments

Comments
 (0)