Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,31 @@ class ActivityErrorResources:
InvalidChannelIdType = ErrorMessage(
"Invalid type for channel_id: {0}. Expected ChannelId or str.",
-64000,
"activity-schema",
)

ChannelIdProductInfoConflict = ErrorMessage(
"Conflict between channel_id.sub_channel and productInfo entity",
-64001,
"activity-schema",
)

ChannelIdValueConflict = ErrorMessage(
"If value is provided, channel and sub_channel must be None",
-64002,
"activity-schema",
)

ChannelIdValueMustBeNonEmpty = ErrorMessage(
"value must be a non empty string if provided",
-64003,
"activity-schema",
)

InvalidFromPropertyType = ErrorMessage(
"Invalid type for from_property: {0}. Expected ChannelAccount or dict.",
-64004,
"activity-schema",
)

InvalidRecipientType = ErrorMessage(
"Invalid type for recipient: {0}. Expected ChannelAccount or dict.",
-64005,
"activity-schema",
)

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,46 @@ class AuthenticationErrorResources:
FailedToAcquireToken = ErrorMessage(
"Failed to acquire token. {0}",
-60012,
"agentic-identity-with-the-m365-agents-sdk",
)

InvalidInstanceUrl = ErrorMessage(
"Invalid instance URL",
-60013,
"agentic-identity-with-the-m365-agents-sdk",
)

OnBehalfOfFlowNotSupportedManagedIdentity = ErrorMessage(
"On-behalf-of flow is not supported with Managed Identity authentication.",
-60014,
"agentic-identity-with-the-m365-agents-sdk",
)

OnBehalfOfFlowNotSupportedAuthType = ErrorMessage(
"On-behalf-of flow is not supported with the current authentication type: {0}",
-60015,
"agentic-identity-with-the-m365-agents-sdk",
)

AuthenticationTypeNotSupported = ErrorMessage(
"Authentication type not supported",
-60016,
"agentic-identity-with-the-m365-agents-sdk",
)

AgentApplicationInstanceIdRequired = ErrorMessage(
"Agent application instance Id must be provided.",
-60017,
"agentic-identity-with-the-m365-agents-sdk",
)

FailedToAcquireAgenticInstanceToken = ErrorMessage(
"Failed to acquire agentic instance token or agent token for agent_app_instance_id {0}",
-60018,
"agentic-identity-with-the-m365-agents-sdk",
)

AgentApplicationInstanceIdAndUserIdRequired = ErrorMessage(
"Agent application instance Id and agentic user Id must be provided.",
-60019,
"agentic-identity-with-the-m365-agents-sdk",
)

FailedToAcquireInstanceOrAgentToken = ErrorMessage(
"Failed to acquire instance token or agent token for agent_app_instance_id {0} and agentic_user_id {1}",
-60020,
"agentic-identity-with-the-m365-agents-sdk",
)

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,36 @@ class CopilotStudioErrorResources:
CloudBaseAddressRequired = ErrorMessage(
"cloud_base_address must be provided when PowerPlatformCloud is Other",
-65000,
"copilot-studio-client",
)

EnvironmentIdRequired = ErrorMessage(
"EnvironmentId must be provided",
-65001,
"copilot-studio-client",
)

AgentIdentifierRequired = ErrorMessage(
"AgentIdentifier must be provided",
-65002,
"copilot-studio-client",
)

CustomCloudOrBaseAddressRequired = ErrorMessage(
"Either CustomPowerPlatformCloud or cloud_base_address must be provided when PowerPlatformCloud is Other",
-65003,
"copilot-studio-client",
)

InvalidConnectionSettingsType = ErrorMessage(
"connection_settings must be of type DirectToEngineConnectionSettings",
-65004,
"copilot-studio-client",
)

PowerPlatformEnvironmentRequired = ErrorMessage(
"PowerPlatformEnvironment must be provided",
-65005,
"copilot-studio-client",
)

AccessTokenProviderRequired = ErrorMessage(
"AccessTokenProvider must be provided",
-65006,
"copilot-studio-client",
)

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ class ErrorMessage:
This class formats error messages according to the Microsoft Agents SDK pattern:
- Original error message
- Error Code: [negative number]
- Help URL: https://aka.ms/M365AgentsErrorCodes/#anchor
- Help URL: https://aka.ms/M365AgentsErrorCodes/#[error_code]
"""

def __init__(
self,
message_template: str,
error_code: int,
help_url_anchor: str = "agentic-identity-with-the-m365-agents-sdk",
):
"""
Initialize an ErrorMessage.
Expand All @@ -29,12 +28,9 @@ def __init__(
:type message_template: str
:param error_code: The error code (should be negative)
:type error_code: int
:param help_url_anchor: The anchor for the help URL (defaults to agentic identity)
:type help_url_anchor: str
"""
self.message_template = message_template
self.error_code = error_code
self.help_url_anchor = help_url_anchor
self.base_url = "https://aka.ms/M365AgentsErrorCodes"

def format(self, *args, **kwargs) -> str:
Expand All @@ -56,7 +52,7 @@ def format(self, *args, **kwargs) -> str:
return (
f"{message}\n\n"
f"Error Code: {self.error_code}\n"
f"Help URL: {self.base_url}/#{self.help_url_anchor}"
f"Help URL: {self.base_url}/#{self.error_code}"
)

def __str__(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,176 +25,147 @@ class ErrorResources:
AdapterRequired = ErrorMessage(
"start_agent_process: adapter can't be None",
-63000,
"hosting-configuration",
)

AgentApplicationRequired = ErrorMessage(
"start_agent_process: agent_application can't be None",
-63001,
"hosting-configuration",
)

RequestRequired = ErrorMessage(
"CloudAdapter.process: request can't be None",
-63002,
"hosting-configuration",
)

AgentRequired = ErrorMessage(
"CloudAdapter.process: agent can't be None",
-63003,
"hosting-configuration",
)

StreamAlreadyEnded = ErrorMessage(
"The stream has already ended.",
-63004,
"streaming",
)

TurnContextRequired = ErrorMessage(
"TurnContext cannot be None.",
-63005,
"hosting-configuration",
)

ActivityRequired = ErrorMessage(
"Activity cannot be None.",
-63006,
"hosting-configuration",
)

AppIdRequired = ErrorMessage(
"AppId cannot be empty or None.",
-63007,
"hosting-configuration",
)

InvalidActivityType = ErrorMessage(
"Invalid or missing activity type.",
-63008,
"hosting-configuration",
)

ConversationIdRequired = ErrorMessage(
"Conversation ID cannot be empty or None.",
-63009,
"hosting-configuration",
)

AuthHeaderRequired = ErrorMessage(
"Authorization header is required.",
-63010,
"hosting-configuration",
)

InvalidAuthHeader = ErrorMessage(
"Invalid authorization header format.",
-63011,
"hosting-configuration",
)

ClaimsIdentityRequired = ErrorMessage(
"ClaimsIdentity is required.",
-63012,
"hosting-configuration",
)

ChannelServiceRouteNotFound = ErrorMessage(
"Channel service route not found for: {0}",
-63013,
"hosting-configuration",
)

TokenExchangeRequired = ErrorMessage(
"Token exchange requires a token exchange resource.",
-63014,
"hosting-configuration",
)

MissingHttpClient = ErrorMessage(
"HTTP client is required.",
-63015,
"hosting-configuration",
)

InvalidBotFrameworkActivity = ErrorMessage(
"Invalid Bot Framework Activity format.",
-63016,
"hosting-configuration",
)

CredentialsRequired = ErrorMessage(
"Credentials are required for authentication.",
-63017,
"hosting-configuration",
)

# General/Validation Errors (-66000 to -66999)
InvalidConfiguration = ErrorMessage(
"Invalid configuration: {0}",
-66000,
"configuration",
)

RequiredParameterMissing = ErrorMessage(
"Required parameter missing: {0}",
-66001,
"configuration",
)

InvalidParameterValue = ErrorMessage(
"Invalid parameter value for {0}: {1}",
-66002,
"configuration",
)

OperationNotSupported = ErrorMessage(
"Operation not supported: {0}",
-66003,
"configuration",
)

ResourceNotFound = ErrorMessage(
"Resource not found: {0}",
-66004,
"configuration",
)

UnexpectedError = ErrorMessage(
"An unexpected error occurred: {0}",
-66005,
"configuration",
)

InvalidStateObject = ErrorMessage(
"Invalid state object: {0}",
-66006,
"configuration",
)

SerializationError = ErrorMessage(
"Serialization error: {0}",
-66007,
"configuration",
)

DeserializationError = ErrorMessage(
"Deserialization error: {0}",
-66008,
"configuration",
)

TimeoutError = ErrorMessage(
"Operation timed out: {0}",
-66009,
"configuration",
)

NetworkError = ErrorMessage(
"Network error occurred: {0}",
-66010,
"configuration",
)

def __init__(self):
Expand Down
Loading
Loading