-
Notifications
You must be signed in to change notification settings - Fork 28
Enhance CosmosDB storage error messages with actionable context #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: cleemullins <[email protected]>
Co-authored-by: cleemullins <[email protected]>
Co-authored-by: Copilot <[email protected]>
…Storage.ts Co-authored-by: Copilot <[email protected]>
…Storage.ts Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…nner exception handling Co-authored-by: cleemullins <[email protected]>
…orDefinition to interface Co-authored-by: cleemullins <[email protected]>
Co-authored-by: cleemullins <[email protected]>
…y indices Co-authored-by: cleemullins <[email protected]>
…rror properties Co-authored-by: cleemullins <[email protected]>
Co-authored-by: cleemullins <[email protected]>
Co-authored-by: cleemullins <[email protected]>
Co-authored-by: cleemullins <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances error messages in the CosmosDB storage error helper module by transforming terse error descriptions into comprehensive, actionable messages. The enhanced messages provide specific context, root causes, and remediation steps to improve developer troubleshooting experience.
Key Changes:
- Enhanced all 20 error definitions with detailed context, root causes, and remediation guidance
- Added concrete examples and configuration requirements (e.g., endpoint URL formats, partition key paths)
- Updated test assertions to validate the new enhanced error descriptions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/agents-hosting-storage-cosmos/src/errorHelper.ts | Enhanced error message descriptions for all 20 error definitions with actionable context and troubleshooting guidance. Contains a critical bug with duplicate property definition. |
| packages/agents-hosting-storage-cosmos/test/errorHelper.test.ts | Updated test assertions to match the new enhanced error descriptions for three configuration-related errors. |
Comments suppressed due to low confidence (1)
packages/agents-hosting-storage-cosmos/src/errorHelper.ts:144
- This property is overwritten by another property in the same object literal.
description: 'Bad request error while reading from the Cosmos DB container. This usually indicates a configuration mismatch: the container may be non-partitioned or uses a partition key path other than "/id". Verify your container\'s partition key configuration matches the storage implementation requirements.',
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
This pull request improves the clarity and usefulness of error messages in the Cosmos DB storage adapter by updating error descriptions to be more detailed and actionable. It also updates the corresponding unit tests to match the new error messages. These changes help developers diagnose configuration and runtime issues more easily.
Enhanced error messages for configuration and runtime issues:
errorHelper.tsto provide clearer guidance for missing or invalid configuration options (e.g., missingCosmosDbPartitionedStorageOptions, missingendpoint, missing credentials, database/container IDs, and key parameters). The new messages specify required properties and offer suggestions for resolution. [1] [2] [3] [4] [5] [6]compatibilityModeandkeySuffix, or invalid characters inkeySuffix. [1] [2]Unit test updates:
errorHelper.test.tsto match the new, more detailed error descriptions, ensuring test coverage remains accurate after the changes.Error messages inerrorHelper.tswere too terse, making troubleshooting difficult. Enhanced all 20 error definitions to provide specific context, root causes, and remediation steps based on code usage patterns.Changes
Configuration Errors
https://your-account.documents.azure.com:443/)InvalidKeySuffixCharactersOperation Errors
read(),write())StoreItems, key arrays)Runtime Errors
Example
Before:
After:
Testing
Updated test assertions to match new descriptions. All tests passing.
Original prompt
Created from VS Code via the GitHub Pull Request extension.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.