Refactor error messages to common classes #799
Merged
cleemullins merged 8 commits intomainfrom Dec 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates error definition help links from the generic M365AgentsErrorCodes to the JavaScript-specific M365AgentsErrorCodesJS to ensure consistency and proper documentation routing for JavaScript error codes.
- Updates all error definition help links to use the JavaScript-specific documentation URL
- Modifies both source error definitions and corresponding test assertions
- Ensures consistency across the agents-hosting-storage-cosmos and agents-activity packages
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/agents-hosting-storage-cosmos/src/errorHelper.ts |
Updated all 20 error definitions to use M365AgentsErrorCodesJS help link |
packages/agents-hosting-storage-cosmos/test/errorHelper.test.ts |
Updated test assertions to verify correct JavaScript-specific help links |
packages/agents-activity/test/exceptionHelper.test.ts |
Updated test case to use JavaScript-specific help link for token replacement validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tions - Added errorHelper.ts to define a comprehensive set of error codes and descriptions for various scenarios. - Updated activityHandler.ts, cloudAdapter.ts, and connectorClient.ts to utilize the new error definitions for improved error handling. - Refactored error throwing to use ExceptionHelper for consistency across the codebase. - Created unit tests for errorHelper to ensure correctness and uniqueness of error codes and messages.
Contributor
|
@cleemullins I've opened a new pull request, #806, to work on those changes. Once the pull request is ready, I'll request review from you. |
…in error generation
…t-related methods for clarity
…r codes and links
benbrown
approved these changes
Dec 2, 2025
Contributor
benbrown
left a comment
There was a problem hiding this comment.
The actual text of the aka.ms link probably should be assumed to be the default when not specified.
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.
This pull request introduces a structured error handling approach to the
agents-activityandagents-hosting-dialogspackages by centralizing error definitions and replacing directthrow new Errorstatements with a standardized exception helper. This improves error consistency, makes error codes and help links available throughout the codebase, and prepares the system for better diagnostics and localization.The most important changes are:
Centralized Error Definitions and Exports
errorHelper.tsfile inagents-activitydefining anErrorsobject with error codes, descriptions, and help links for all major error scenarios in the Activity system. This object is now exported asActivityErrorsfor external use. [1] [2]Refactoring Error Handling in Activity System
Activityclass and related logic to useExceptionHelper.generateExceptionwith entries from the newErrorsobject, replacing all directthrow new Errorcalls for invalid activity types, channel IDs, and required properties. [1] [2] [3] [4] [5]Refactoring Error Handling in Dialog System
agents-hosting-dialogs(agentStateSet.ts,dialog.ts,dialogContextError.ts,dialogHelper.ts,dialogManager.ts,dialogSet.ts) to use the new error handling pattern, replacing direct error throws withExceptionHelper.generateExceptionand correspondingErrorsentries for various validation and configuration errors. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Test Adjustments
exceptionHelper.test.tsto reflect the new help link format in error definitions.This refactor makes error handling more robust, maintainable, and user-friendly by providing consistent error codes and documentation links across the codebase.Change all error definitions to point to the JavaScript version of the help links, ensuring consistency across the error handling implementation.
There are many JS Errors that need to be documented - enough that putting them into their own documentation file seems the most straigforward answer.