Skip to content

Show readable Azure and Cosmos DB service errors - #283

Merged
Mike Krüger (mkrueger) merged 4 commits into
mainfrom
dev/mkrueger/fix/272-readable-service-errors
Nov 5, 2026
Merged

Mike Krüger (mkrueger) merged 4 commits into
mainfrom
dev/mkrueger/fix/272-readable-service-errors

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

Summary

  • Extract actionable messages from nested Azure/Cosmos DB service errors, including account throughput-limit failures, while retaining original exceptions for diagnostics.
  • Keep CLI and MCP errors concise; include full exception details in MCP logs only with the existing --verbose flag.
  • Preserve command names, inner-error details, exit codes, request charges, and structured error results.
  • Add regression coverage and update the changelog and MCP documentation.

Fixes #272.

Validation

  • App and test projects build successfully with no warnings.
  • Offline regression suite: 5,078 passed, 6 skipped.
  • git diff --check passes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The early return drops actionable inner-error details from CLI output, so recursive display formatting must be preserved while summary messages remain limited to the exception’s own sanitized message.

1 open issue
What changed in this PR

This PR addresses #272 by making Azure and Cosmos DB service failures easier to read in CLI and MCP output while retaining original exceptions for diagnostics.

Changes:

  • Extract actionable messages from recognized nested service-error payloads.
  • Limit full MCP exception logging to --verbose.
  • Add regression coverage and document the error-output behavior.
File Description
docs/​mcp.md Documents concise errors and verbose logging.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Mcp/​ToolOperations.cs Uses concise error messages and conditional exception logging.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Mcp/​McpResponseFactory.cs Summarizes service errors in MCP responses.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​ShellInterpreter.cs Wraps service exceptions with command context.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​CommandException.cs Extracts service messages and separates summary formatting.
CosmosDBShell.Tests/​ToolOperationsCallToolTests.cs Tests MCP error responses and verbose logging.
CosmosDBShell.Tests/​Shell/​ExecuteCommandExceptionTests.cs Tests CLI service-error rendering.
CosmosDBShell.Tests/​Shell/​CommandExceptionServiceErrorTests.cs Tests payload extraction, fallback, and exception preservation.
CosmosDBShell.Tests/​McpResponseFactoryTests.cs Tests concise errors with structured results.
CHANGELOG.md Records the service-error readability improvement.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 819d404 dev/mkrueger/fix/272... 7eb8966 +/-
74% 74% 0%
View coverage of the 3 most impacted files.
File main 819d404 dev/mkrueger/fix/272... 7eb8966 +/-
D:\a\CosmosDBSh...lInterpreter.cs 80% 80% 0%
D:\a\CosmosDBSh...olOperations.cs 95% 95% 0%
D:\a\CosmosDBSh...andException.cs 96% 97% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 05, 2026 10:52 UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An early return in CommandException discards actionable inner-exception details for unrecognized service payloads, hiding DNS/TLS root causes from normal CLI output.

1 open issue

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An early return in GetDisplayMessage drops actionable inner-exception details for Azure/Cosmos errors, and the new wrapper prevents those details from being rendered separately.

1 open issue

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 10:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the Azure and Cosmos DB error-reporting changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@mkrueger
Mike Krüger (mkrueger) merged commit de07252 into main Nov 5, 2026
13 checks passed
@mkrueger
Mike Krüger (mkrueger) deleted the dev/mkrueger/fix/272-readable-service-errors branch November 5, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants