From 27c7ab93d82bd246eb5a2fd624a39ece80b81d36 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 21 Jul 2026 21:51:56 -0700 Subject: [PATCH 1/2] Fixing exception handling --- .../copilotstudio/client/power_platform_environment.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py index a25321b1c..12804f095 100644 --- a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py +++ b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py @@ -330,7 +330,7 @@ def get_environment_endpoint( @staticmethod def get_endpoint_suffix(cloud: PowerPlatformCloud, cloud_base_address: str) -> str: - return { + res = { PowerPlatformCloud.LOCAL: "api.powerplatform.localhost", PowerPlatformCloud.EXP: "api.exp.powerplatform.com", PowerPlatformCloud.DEV: "api.dev.powerplatform.com", @@ -347,7 +347,11 @@ def get_endpoint_suffix(cloud: PowerPlatformCloud, cloud_base_address: str) -> s PowerPlatformCloud.EX: "api.powerplatform.eaglex.ic.gov", PowerPlatformCloud.RX: "api.powerplatform.microsoft.scloud", PowerPlatformCloud.OTHER: cloud_base_address, - }.get(cloud, ValueError(f"Invalid cloud category value: {cloud}")) + }.get(cloud) + + if not res: + raise ValueError(f"Invalid cloud category value: {cloud}") + return res @staticmethod def get_id_suffix_length(cloud: PowerPlatformCloud) -> int: From cd30959a5fe5790d87b47dca402a1f92e871513e Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Wed, 22 Jul 2026 09:03:32 -0700 Subject: [PATCH 2/2] Formatting --- .../copilotstudio/client/power_platform_environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py index 12804f095..8a5f76e8b 100644 --- a/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py +++ b/libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py @@ -348,7 +348,7 @@ def get_endpoint_suffix(cloud: PowerPlatformCloud, cloud_base_address: str) -> s PowerPlatformCloud.RX: "api.powerplatform.microsoft.scloud", PowerPlatformCloud.OTHER: cloud_base_address, }.get(cloud) - + if not res: raise ValueError(f"Invalid cloud category value: {cloud}") return res