UNPKG

touchdesigner-mcp-server

Version:
20 lines (19 loc) 609 B
/** * Handles API errors consistently across the application */ export function handleToolError(error, logger, toolName, referenceComment) { const formattedError = error instanceof Error ? error : new Error(error === null ? "Null error received" : String(error)); logger.error(toolName, formattedError); const errorMessage = `${toolName}: ${formattedError}${referenceComment ? `. ${referenceComment}` : ""}`; return { isError: true, content: [ { type: "text", text: errorMessage, }, ], }; }