Elffuss BraidHub

kikocis/continue public

main · 369 BRawPermalink
1export function safeParseArgs(
2 args: string | undefined,
3 errorId?: string,
4): Record<string, any> {
5 try {
6 return JSON.parse(args?.trim() || "{}");
7 } catch (e) {
8 const identifier = errorId ? `Call: ${errorId}\nArgs:${args}\n` : "";
9 console.error(
10 `Failed to parse tool call arguments\n${identifier}Error:`,
11 e,
12 );
13 return {};
14 }
15}