Refactor error definitions to eliminate duplicate helplink properties#808
Merged
cleemullins merged 5 commits intomainfrom Dec 3, 2025
Merged
Refactor error definitions to eliminate duplicate helplink properties#808cleemullins merged 5 commits intomainfrom
cleemullins merged 5 commits intomainfrom
Conversation
Co-authored-by: cleemullins <1165321+cleemullins@users.noreply.github.com>
- Made helplink optional in AgentErrorDefinition interface - Added DEFAULT_HELPLINK constant in ExceptionHelper class - Updated ExceptionHelper.generateException to use default when helplink not provided - Added tests for default and override helplink behavior - Removed all duplicate helplink properties from error definitions across all packages - Updated existing tests to reflect optional helplink behavior Co-authored-by: cleemullins <1165321+cleemullins@users.noreply.github.com>
Co-authored-by: cleemullins <1165321+cleemullins@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor errorHelper to eliminate duplicate helpLink lines
Refactor error definitions to eliminate duplicate helplink properties
Dec 2, 2025
cleemullins
approved these changes
Dec 2, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR successfully refactors the error handling system to eliminate ~180 duplicate helplink property declarations across all error definitions. The refactoring makes the helplink property optional in AgentErrorDefinition, with errors now inheriting a default help link pattern (https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}) from the ExceptionHelper class when no custom help link is specified.
Key Changes:
- Made
helplinkoptional in theAgentErrorDefinitioninterface with proper TypeScript typing - Added
DEFAULT_HELPLINKconstant to theExceptionHelperclass using nullish coalescing for fallback behavior - Removed duplicate
helplinkproperties from all error definitions across multiple packages while preserving the ability to override with custom help links - Added comprehensive test coverage validating both default and custom help link scenarios
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/agents-activity/src/exceptionHelper.ts |
Added DEFAULT_HELPLINK constant and made helplink optional in AgentErrorDefinition interface; implemented fallback logic using nullish coalescing operator |
packages/agents-activity/src/errorHelper.ts |
Removed duplicate helplink properties from all 8 error definitions |
packages/agents-activity/test/exceptionHelper.test.ts |
Added 3 new test cases validating default helplink behavior and custom helplink override capability |
packages/agents-hosting/src/errorHelper.ts |
Removed duplicate helplink properties from all 75 error definitions |
packages/agents-hosting/test/errorHelper.test.ts |
Updated test to reflect optional helplink with explanatory comment |
packages/agents-hosting-storage-cosmos/src/errorHelper.ts |
Removed duplicate helplink properties from all 20 error definitions |
packages/agents-hosting-storage-cosmos/test/errorHelper.test.ts |
Updated assertions to expect undefined helplink and removed token validation test in favor of default behavior verification |
packages/agents-hosting-storage-blob/src/errorHelper.ts |
Removed duplicate helplink properties from all 3 error definitions |
packages/agents-hosting-storage-blob/test/errorHelper.test.ts |
Updated test to reflect optional helplink with explanatory comment |
packages/agents-hosting-extensions-teams/src/errorHelper.ts |
Removed duplicate helplink properties from all 19 error definitions |
packages/agents-hosting-extensions-teams/test/errorHelper.test.ts |
Updated test to reflect optional helplink with explanatory comment |
packages/agents-hosting-dialogs/src/errorHelper.ts |
Removed duplicate helplink properties from all 38 error definitions |
packages/agents-hosting-dialogs/test/errorHelper.test.ts |
Updated test to reflect optional helplink with explanatory comment |
.gitignore |
Removed generated line (appears unrelated to error refactoring) |
package-lock.json |
Auto-generated npm dependency resolution updates marking various packages as peer dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
benbrown
approved these changes
Dec 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every error definition across all packages specified the same helplink pattern, duplicating
'https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}'over 180 times.Changes
helplinkoptional inAgentErrorDefinition- defaults toExceptionHelper.DEFAULT_HELPLINKwhen omittedDEFAULT_HELPLINKconstant toExceptionHelperclassExample
Before:
After:
Custom helplinks can still be specified when needed:
The
{errorCode}token replacement happens at exception generation time, producing URLs likehttps://aka.ms/M365AgentsErrorCodesJS/#-110000.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.