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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "uipath-runtime"
version = "0.1.2"
version = "0.1.3"
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"uipath-core>=0.0.5, <0.1.0",
"uipath-core>=0.0.9, <0.1.0",
]
classifiers = [
"Intended Audience :: Developers",
Expand Down
26 changes: 16 additions & 10 deletions src/uipath/runtime/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Any

from pydantic import BaseModel, ConfigDict
from uipath.core.errors import UiPathFaultedTriggerError
from uipath.core.tracing import UiPathTraceManager

from uipath.runtime.errors import (
Expand Down Expand Up @@ -167,16 +168,21 @@ def __exit__(self, exc_type, exc_val, exc_tb):

if exc_type:
# Create error info from exception
if isinstance(exc_val, UiPathRuntimeError):
error_info = exc_val.error_info
else:
# Generic error
error_info = UiPathErrorContract(
code=f"ERROR_{exc_type.__name__}",
title=f"Runtime error: {exc_type.__name__}",
detail=str(exc_val),
category=UiPathErrorCategory.UNKNOWN,
)
match exc_type:
case UiPathFaultedTriggerError():
error_info = UiPathRuntimeError.from_resume_trigger_error(
exc_type
).error_info
case UiPathRuntimeError():
error_info = exc_val.error_info
case _:
# Generic error
error_info = UiPathErrorContract(
code=f"ERROR_{exc_type.__name__}",
title=f"Runtime error: {exc_type.__name__}",
detail=str(exc_val),
category=UiPathErrorCategory.UNKNOWN,
)

self.result.status = UiPathRuntimeStatus.FAULTED
self.result.error = error_info
Expand Down
5 changes: 4 additions & 1 deletion src/uipath/runtime/debug/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import logging
from typing import Any, AsyncGenerator, cast

from uipath.core.errors import UiPathPendingTriggerError

from uipath.runtime.base import (
UiPathExecuteOptions,
UiPathRuntimeProtocol,
Expand Down Expand Up @@ -273,7 +275,8 @@ async def _poll_trigger(

except UiPathDebugQuitError:
raise
except Exception as e:

except UiPathPendingTriggerError as e:
await self.debug_bridge.emit_state_update(
UiPathRuntimeStateEvent(
node_name="<polling>",
Expand Down
1 change: 1 addition & 0 deletions src/uipath/runtime/errors/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class UiPathErrorCode(str, Enum):
INPUT_INVALID_JSON = "INPUT_INVALID_JSON"

# HITL (Human-In-The-Loop) related errors
RESUME_TRIGGER_ERROR = "RESUME_TRIGGER_ERROR"
INVOKED_PROCESS_FAILURE = "INVOKED_PROCESS_FAILURE"
CREATE_RESUME_TRIGGER_ERROR = "CREATE_RESUME_TRIGGER_ERROR"
RETRIEVE_RESUME_TRIGGER_ERROR = "RETRIEVE_PAYLOAD_ERROR"
Expand Down
14 changes: 14 additions & 0 deletions src/uipath/runtime/errors/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import traceback
from typing import Any

from uipath.core.errors import UiPathFaultedTriggerError

from uipath.runtime.errors.codes import UiPathErrorCode
from uipath.runtime.errors.contract import UiPathErrorCategory, UiPathErrorContract

Expand Down Expand Up @@ -99,3 +101,15 @@ def __init__(
prefix=prefix,
include_traceback=include_traceback,
)

@classmethod
def from_resume_trigger_error(
cls, exc: UiPathFaultedTriggerError
) -> "UiPathRuntimeError":
"""Create UiPathRuntimeError from UiPathFaultedTriggerError."""
return cls(
code=UiPathErrorCode.RESUME_TRIGGER_ERROR,
title="Resume trigger error",
detail=exc.message,
category=UiPathErrorCategory(exc.category),
)
1 change: 0 additions & 1 deletion src/uipath/runtime/resumable/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async def execute(

# Execute the delegate
result = await self.delegate.execute(input, options=options)

# If suspended, create and persist trigger
return await self._handle_suspension(result)

Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.