From 199d63a48196eac1a2183edc3810326c49f6d82d Mon Sep 17 00:00:00 2001 From: giuliastf Date: Thu, 7 Aug 2025 17:13:37 +0300 Subject: [PATCH] feat(err_license): handle License not Available err --- pyproject.toml | 2 +- src/uipath_langchain/_utils/_request_mixin.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ef07017..b0396e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-langchain" -version = "0.0.122" +version = "0.0.123" description = "UiPath Langchain" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.10" diff --git a/src/uipath_langchain/_utils/_request_mixin.py b/src/uipath_langchain/_utils/_request_mixin.py index f93a2b8..50ec183 100644 --- a/src/uipath_langchain/_utils/_request_mixin.py +++ b/src/uipath_langchain/_utils/_request_mixin.py @@ -17,8 +17,10 @@ stop_after_attempt, wait_exponential_jitter, ) +from uipath._cli._runtime._contracts import UiPathErrorCategory from uipath._utils._ssl_context import get_httpx_client_kwargs +from uipath_langchain._cli._runtime._exception import LangGraphRuntimeError from uipath_langchain._utils._settings import ( UiPathClientFactorySettings, UiPathClientSettings, @@ -348,6 +350,19 @@ def _make_status_error( return openai.AuthenticationError(err_msg, response=response, body=data) if response.status_code == 403: + # Check if this is a license-specific error + if isinstance(body, dict): + title = body.get("title", "").lower() + if title == "license not available": + raise LangGraphRuntimeError( + code="LICENSE_NOT_AVAILABLE", + title=body.get("title", "License Not Available"), + detail=body.get( + "detail", "License not available for this service" + ), + category=UiPathErrorCategory.DEPLOYMENT, + ) + return openai.PermissionDeniedError(err_msg, response=response, body=data) if response.status_code == 404: