Skip to content

Replace help_url_anchor with error_code in error message URLs#237

Merged
cleemullins merged 2 commits intomainfrom
copilot/update-error-links-to-use-code
Nov 11, 2025
Merged

Replace help_url_anchor with error_code in error message URLs#237
cleemullins merged 2 commits intomainfrom
copilot/update-error-links-to-use-code

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Error messages were generating help URLs using a static anchor text parameter. This required maintaining separate anchor strings for each error and prevented direct linking to specific error codes.

Changes

ErrorMessage class (error_message.py)

  • Removed help_url_anchor parameter from constructor
  • Generate URLs using error code: https://aka.ms/M365AgentsErrorCodes/#-60000

Error resources (7 libraries, 77 error messages)

  • Removed third parameter from all ErrorMessage() instantiations
  • Updated test assertions to validate new URL format

Before/After

# Before
ErrorMessage(
    "Failed to acquire token. {0}",
    -60012,
    "agentic-identity-with-the-m365-agents-sdk",  # Static anchor
)
# URL: https://aka.ms/M365AgentsErrorCodes/#agentic-identity-with-the-m365-agents-sdk

# After
ErrorMessage(
    "Failed to acquire token. {0}",
    -60012,
)
# URL: https://aka.ms/M365AgentsErrorCodes/#-60012

Affected libraries: authentication-msal, storage-cosmos, storage-blob, hosting-teams, activity, copilotstudio-client, hosting-core.

Original prompt

This section details on the original issue you should resolve

<issue_title>Updating Error links to use error code and not help anchor</issue_title>
<issue_description>Update the file:
https://github.com/microsoft/Agents-for-python/blob/main/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py

This update should change the behavior of the help link from being generated using the "help_url_anchor" to just using the error code.

Remove the "help_url_anchor" altogether and simply replace it with the error code. This means the resulting URLs should look like:

This will REQUIRE changes to error_resources file in each of the python projects. Those files need to have the help_url_anchor removed from all instances, as it's no longer needed.

The projects this will impact are:

  • Authentication (microsoft-agents-authentication-msal): -60000 to -60999
  • Storage - Cosmos (microsoft-agents-storage-cosmos): -61000 to -61999
  • Storage - Blob (microsoft-agents-storage-blob): -61100 to -61199
  • Teams (microsoft-agents-hosting-teams): -62000 to -62999
  • Hosting (microsoft-agents-hosting-core): -63000 to -63999
  • Activity (microsoft-agents-activity): -64000 to -64999
  • Copilot Studio (microsoft-agents-copilotstudio-client): -65000 to -65999
  • General/Validation (microsoft-agents-hosting-core): -66000 to -66999

Format all code using the Black formatter.
Run all unit tests. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: cleemullins <1165321+cleemullins@users.noreply.github.com>
Copilot AI changed the title [WIP] Update error links to use error code instead of help anchor Replace help_url_anchor with error_code in error message URLs Nov 11, 2025
Copilot AI requested a review from cleemullins November 11, 2025 21:53
@cleemullins cleemullins marked this pull request as ready for review November 11, 2025 22:06
@cleemullins cleemullins requested a review from a team as a code owner November 11, 2025 22:06
Copilot AI review requested due to automatic review settings November 11, 2025 22:06
Copy link
Contributor

Copilot AI left a 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 refactors error message URL generation to use error codes directly as URL anchors instead of static anchor strings. This simplifies maintenance by eliminating the need to maintain separate anchor text for each error message and enables direct linking to specific error codes in documentation.

  • Removed help_url_anchor parameter from ErrorMessage class constructor
  • Updated URL generation to use error codes: https://aka.ms/M365AgentsErrorCodes/#-60000
  • Updated 77 error message instantiations across 7 libraries and corresponding test assertions

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py Removed help_url_anchor parameter and updated URL generation to use error code directly
tests/hosting_core/errors/test_error_resources.py Updated test instantiations and assertions to validate new URL format using error codes
libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py Removed third parameter from 9 error message instantiations
libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py Removed third parameter from 13 error message instantiations
libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py Removed third parameter from 4 error message instantiations
libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py Removed third parameter from 10 error message instantiations
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py Removed third parameter from 28 error message instantiations
libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py Removed third parameter from 7 error message instantiations
libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py Removed third parameter from 6 error message instantiations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cleemullins cleemullins merged commit 4ac1998 into main Nov 11, 2025
16 checks passed
@cleemullins cleemullins deleted the copilot/update-error-links-to-use-code branch November 11, 2025 22:15
Copilot AI mentioned this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating Error links to use error code and not help anchor

3 participants

Comments