fix: 请求/v1/messages/count_tokens 的CanceledError 不再被记录为ERROR 日志

This commit is contained in:
sususu
2025-11-05 09:47:37 +08:00
parent a2b04eea07
commit 9b15e08624
2 changed files with 18 additions and 1 deletions

View File

@@ -317,7 +317,12 @@ class ClaudeConsoleRelayService {
}
} catch (error) {
// 处理特定错误
if (error.name === 'AbortError' || error.code === 'ECONNABORTED') {
if (
error.name === 'AbortError' ||
error.name === 'CanceledError' ||
error.code === 'ECONNABORTED' ||
error.code === 'ERR_CANCELED'
) {
logger.info('Request aborted due to client disconnect')
throw new Error('Client disconnected')
}