MCPcopy Create free account
hub / github.com/agent-tower/core / handleError

Method handleError

packages/server/src/output/codex-parser.ts:421–458  ·  view source on GitHub ↗

* 处理错误事件(type: error / turn.failed) * - 重试类消息(Reconnecting... N/M):原地更新同一个 entry * - 普通错误:去重后创建新 entry

(message: string)

Source from the content-addressed store, hash-verified

419 content: typeof t?.text === 'string' ? stripAnsiSequences(t.text) : '',
420 status: t?.completed ? 'completed' : 'pending',
421 }));
422
423 const summary = todos.length > 0
424 ? todos.map((t) => `${t.status === 'completed' ? '[x]' : '[ ]'} ${t.content}`).join('\n')
425 : 'Todo list';
426
427 const entry = createToolUse('update_plan', summary, 'todo_management', item.id, item.id);
428 this.upsertItemEntry(item.id, {
429 ...entry,
430 metadata: {
431 ...entry.metadata,
432 ...(todos.length > 0 ? { todos } : {}),
433 },
434 });
435 }
436
437 private createMcpToolEntry(item: CodexItem, status: ToolStatus): NormalizedEntry {
438 const toolName = item.tool || 'mcp';
439 const content = this.formatMcpToolContent(item);
440 const entry = createToolUse(toolName, content, 'tool', item.id, item.id);
441
442 return {
443 ...entry,
444 metadata: {
445 ...entry.metadata,
446 status,
447 },
448 };
449 }
450
451 private formatMcpToolContent(item: CodexItem): string {
452 const target = item.server && item.tool ? `${item.server}/${item.tool}` : item.tool || item.server || 'mcp';
453 const lines = [`MCP tool call: ${target}`];
454
455 if (item.server) lines.push(`Server: ${item.server}`);
456 if (item.tool) lines.push(`Tool: ${item.tool}`);
457 if (item.status) lines.push(`Status: ${item.status}`);
458 if (item.arguments !== undefined) lines.push(`Arguments: ${this.formatJsonValue(item.arguments)}`);
459 if (item.result !== undefined && item.result !== null) lines.push(`Result: ${this.formatJsonValue(item.result)}`);
460 if (item.error !== undefined && item.error !== null) lines.push(`Error: ${this.formatJsonValue(item.error)}`);
461

Callers 1

handleEventMethod · 0.95

Calls 7

isRetryMessageMethod · 0.95
updateEntryContentFunction · 0.85
createErrorMessageFunction · 0.85
addNormalizedEntryFunction · 0.85
pushPatchMethod · 0.80
nextMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected