Skip to content

Refactor Python error exception text to a single resource file #222

@cleemullins

Description

@cleemullins

Related to:
microsoft/Agents#294
microsoft/Agents#273
microsoft/Agents#339

Refactor the error / exception text that's currently throughout the codebase into a single resource file. The C# pattern for this is here:
https://github.com/microsoft/Agents-for-net/edit/main/src/libraries/Client/Microsoft.Agents.Connector/Errors/ErrorHelper.cs#L36C66

This error text should include 3 things:

  1. The formatting string used for the error. (extracted from the current code)
  2. An Error code (can align with C#) that get added to the error text.
  3. A URL that also gets added to the error text. The URL should follow the pattern:
    https://aka.ms/M365AgentsErrorCodes/#agentic-identity-with-the-m365-agents-sdk

This should result in an exception that looks like:

  • Original code: raise ValueError(f"Failed to acquire token. {str(auth_result_payload)}")
  • Revised Code: raise ValueError(f"{error_resources.FailedToAcquireToken})

The actual logged string would look like:

Failed to acquire token. 
... [payload goes here, just as it does today] ...

Error Code: -60012
Help URL: https://aka.ms/M365AgentsErrorCodes/#agentic-identity-with-the-m365-agents-sdk

Once the code is refactored, I'll update the URLs for the Agentic Errors to have the correct deep-link hashtags.

This refactor seems a good candidate for being done via a one of the LLMs.

Metadata

Metadata

Assignees

Labels

DocumentationImprovements or additions to documentationP1

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions