diff --git a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt index 34eafc3d..8832c4db 100644 --- a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt +++ b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt @@ -1 +1 @@ -797 +798 diff --git a/src/Backend/AutopilotMonitor.Functions/Helpers/ResponseHelper.cs b/src/Backend/AutopilotMonitor.Functions/Helpers/ResponseHelper.cs index 50dfa5b3..4a7b6c35 100644 --- a/src/Backend/AutopilotMonitor.Functions/Helpers/ResponseHelper.cs +++ b/src/Backend/AutopilotMonitor.Functions/Helpers/ResponseHelper.cs @@ -131,12 +131,14 @@ public static class ResponseHelper { return ex switch { + RequestFailedException rfe when rfe.ErrorCode != null => + $"{operation}: {rfe.ErrorCode} — {rfe.Message}", RequestFailedException rfe => - $"{operation}: {rfe.ErrorCode ?? $"Azure error (HTTP {rfe.Status})"} — {rfe.Message}", + $"{operation}: Azure error (HTTP {rfe.Status}). Use correlationId to investigate in backend logs.", ArgumentException ae => $"{operation}: Invalid argument — {ae.Message}", - InvalidOperationException ioe => - $"{operation}: {ioe.Message}", + InvalidOperationException => + $"{operation}: Invalid operation. Use correlationId to investigate in backend logs.", TimeoutException => $"{operation}: The operation timed out", TaskCanceledException => diff --git a/src/McpServer/autopilot-monitor-mcp/src/tools/error-handler.ts b/src/McpServer/autopilot-monitor-mcp/src/tools/error-handler.ts index 1badc79b..0440bee7 100644 --- a/src/McpServer/autopilot-monitor-mcp/src/tools/error-handler.ts +++ b/src/McpServer/autopilot-monitor-mcp/src/tools/error-handler.ts @@ -40,7 +40,9 @@ export function toolError( } else if (error.status === 429) { parts.push(`**Rate limited in ${toolName}**: Too many requests. Wait a moment and retry.`); } else { - parts.push(`**Error in ${toolName}** (HTTP ${error.status}): ${error.body || 'No response body'}`); + const body = error.body || 'No response body'; + const truncated = body.length > 500 ? body.slice(0, 500) + '…' : body; + parts.push(`**Error in ${toolName}** (HTTP ${error.status}): ${truncated}`); } } else { const message = error instanceof Error ? error.message : String(error);