diff --git a/libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py b/libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py index b35f81ce..d652496b 100644 --- a/libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py +++ b/libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py @@ -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): diff --git a/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py b/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py index b0a347c3..0c97a34a 100644 --- a/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py +++ b/libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py @@ -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): diff --git a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py index 3b470d6e..3c32eb42 100644 --- a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py +++ b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py @@ -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): diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py index 08b6eb24..32284133 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py @@ -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. @@ -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: @@ -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: diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py index ac6a1723..02639300 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py @@ -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): diff --git a/libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py b/libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py index 888e930a..00895304 100644 --- a/libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py +++ b/libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py @@ -20,61 +20,51 @@ class TeamsErrorResources: TeamsBadRequest = ErrorMessage( "BadRequest", -62000, - "teams-integration", ) TeamsNotImplemented = ErrorMessage( "NotImplemented", -62001, - "teams-integration", ) TeamsContextRequired = ErrorMessage( "context is required.", -62002, - "teams-integration", ) TeamsMeetingIdRequired = ErrorMessage( "meeting_id is required.", -62003, - "teams-integration", ) TeamsParticipantIdRequired = ErrorMessage( "participant_id is required.", -62004, - "teams-integration", ) TeamsTeamIdRequired = ErrorMessage( "team_id is required.", -62005, - "teams-integration", ) TeamsTurnContextRequired = ErrorMessage( "TurnContext cannot be None", -62006, - "teams-integration", ) TeamsActivityRequired = ErrorMessage( "Activity cannot be None", -62007, - "teams-integration", ) TeamsChannelIdRequired = ErrorMessage( "The teams_channel_id cannot be None or empty", -62008, - "teams-integration", ) TeamsConversationIdRequired = ErrorMessage( "conversation_id is required.", -62009, - "teams-integration", ) def __init__(self): diff --git a/libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py b/libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py index 4b4f781d..fd0f8209 100644 --- a/libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py +++ b/libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py @@ -20,25 +20,21 @@ class BlobStorageErrorResources: BlobStorageConfigRequired = ErrorMessage( "BlobStorage: BlobStorageConfig is required.", -61100, - "storage-configuration", ) BlobConnectionStringOrUrlRequired = ErrorMessage( "BlobStorage: either connection_string or container_url is required.", -61101, - "storage-configuration", ) BlobContainerNameRequired = ErrorMessage( "BlobStorage: container_name is required.", -61102, - "storage-configuration", ) InvalidConfiguration = ErrorMessage( "Invalid configuration: {0}", -61103, - "configuration", ) def __init__(self): diff --git a/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py b/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py index 1137144a..72c97d4a 100644 --- a/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py +++ b/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py @@ -20,79 +20,66 @@ class StorageErrorResources: CosmosDbConfigRequired = ErrorMessage( "CosmosDBStorage: CosmosDBConfig is required.", -61000, - "storage-configuration", ) CosmosDbEndpointRequired = ErrorMessage( "CosmosDBStorage: cosmos_db_endpoint is required.", -61001, - "storage-configuration", ) CosmosDbAuthKeyRequired = ErrorMessage( "CosmosDBStorage: auth_key is required.", -61002, - "storage-configuration", ) CosmosDbDatabaseIdRequired = ErrorMessage( "CosmosDBStorage: database_id is required.", -61003, - "storage-configuration", ) CosmosDbContainerIdRequired = ErrorMessage( "CosmosDBStorage: container_id is required.", -61004, - "storage-configuration", ) CosmosDbKeyCannotBeEmpty = ErrorMessage( "CosmosDBStorage: Key cannot be empty.", -61005, - "storage-configuration", ) CosmosDbPartitionKeyInvalid = ErrorMessage( "CosmosDBStorage: PartitionKey of {0} cannot be used with a CosmosDbPartitionedStorageOptions.PartitionKey of {1}.", -61006, - "storage-configuration", ) CosmosDbPartitionKeyPathInvalid = ErrorMessage( "CosmosDBStorage: PartitionKeyPath must match cosmosDbPartitionedStorageOptions value of {0}", -61007, - "storage-configuration", ) CosmosDbCompatibilityModeRequired = ErrorMessage( "CosmosDBStorage: compatibilityMode cannot be set when using partitionKey options.", -61008, - "storage-configuration", ) CosmosDbPartitionKeyNotFound = ErrorMessage( "CosmosDBStorage: Partition key '{0}' missing from state, you may be missing custom state implementation.", -61009, - "storage-configuration", ) CosmosDbInvalidPartitionKeyValue = ErrorMessage( "CosmosDBStorage: Invalid PartitionKey property on item with id {0}", -61010, - "storage-configuration", ) CosmosDbInvalidKeySuffixCharacters = ErrorMessage( "Cannot use invalid Row Key characters: {0} in keySuffix.", -61011, - "storage-configuration", ) InvalidConfiguration = ErrorMessage( "Invalid configuration: {0}", -61012, - "configuration", ) def __init__(self): diff --git a/tests/hosting_core/errors/test_error_resources.py b/tests/hosting_core/errors/test_error_resources.py index 77ce3e67..05b8a720 100644 --- a/tests/hosting_core/errors/test_error_resources.py +++ b/tests/hosting_core/errors/test_error_resources.py @@ -18,43 +18,42 @@ class TestErrorMessage: def test_error_message_basic(self): """Test basic error message creation.""" - error = ErrorMessage("Test error message", -60000, "test-anchor") + error = ErrorMessage("Test error message", -60000) assert error.message_template == "Test error message" assert error.error_code == -60000 - assert error.help_url_anchor == "test-anchor" def test_error_message_format_no_args(self): """Test formatting error message without arguments.""" - error = ErrorMessage("Simple error", -60001, "test") + error = ErrorMessage("Simple error", -60001) formatted = error.format() assert "Simple error" in formatted assert "Error Code: -60001" in formatted - assert "Help URL: https://aka.ms/M365AgentsErrorCodes/#test" in formatted + assert "Help URL: https://aka.ms/M365AgentsErrorCodes/#-60001" in formatted def test_error_message_format_with_positional_args(self): """Test formatting error message with positional arguments.""" - error = ErrorMessage("Error with {0} and {1}", -60002, "test") + error = ErrorMessage("Error with {0} and {1}", -60002) formatted = error.format("arg1", "arg2") assert "Error with arg1 and arg2" in formatted assert "Error Code: -60002" in formatted def test_error_message_format_with_keyword_args(self): """Test formatting error message with keyword arguments.""" - error = ErrorMessage("Error with {name} and {value}", -60003, "test") + error = ErrorMessage("Error with {name} and {value}", -60003) formatted = error.format(name="test_name", value="test_value") assert "Error with test_name and test_value" in formatted assert "Error Code: -60003" in formatted def test_error_message_str(self): """Test string representation of error message.""" - error = ErrorMessage("Test error", -60004, "test") + error = ErrorMessage("Test error", -60004) str_repr = str(error) assert "Test error" in str_repr assert "Error Code: -60004" in str_repr def test_error_message_repr(self): """Test repr of error message.""" - error = ErrorMessage("Test error message", -60005, "test") + error = ErrorMessage("Test error message", -60005) repr_str = repr(error) assert "ErrorMessage" in repr_str assert "-60005" in repr_str @@ -218,7 +217,7 @@ def test_authentication_error_format(self): formatted = error.format("test_payload") assert "Failed to acquire token. test_payload" in formatted assert "Error Code: -60012" in formatted - assert "agentic-identity-with-the-m365-agents-sdk" in formatted + assert "#-60012" in formatted except ImportError: pytest.skip("Authentication package not available")