From 3c13c20587cf67c9d57ba093316894a607b681de Mon Sep 17 00:00:00 2001 From: CrazyBoyM Date: Mon, 25 Aug 2025 06:40:30 +0800 Subject: [PATCH] fix: correct API error log file path display --- src/utils/debugLogger.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/debugLogger.ts b/src/utils/debugLogger.ts index dfb9dbc..3874e96 100644 --- a/src/utils/debugLogger.ts +++ b/src/utils/debugLogger.ts @@ -471,7 +471,12 @@ export function logAPIError(context: { // 确保目录存在 if (!existsSync(errorDir)) { - mkdirSync(errorDir, { recursive: true }) + try { + mkdirSync(errorDir, { recursive: true }) + } catch (err) { + console.error('Failed to create error log directory:', err) + return // Exit early if we can't create the directory + } } // 生成文件名 @@ -557,7 +562,7 @@ export function logAPIError(context: { } console.log() - console.log(chalk.dim(` 📁 Full log: ~/.kode/logs/error/api/${filename}`)) + console.log(chalk.dim(` 📁 Full log: ${filepath}`)) console.log(chalk.red('━'.repeat(60))) console.log() }