|
8 | 8 | from typing import Any |
9 | 9 |
|
10 | 10 | from pydantic import BaseModel, ConfigDict |
| 11 | +from uipath.core.errors import UiPathFaultedTriggerError |
11 | 12 | from uipath.core.tracing import UiPathTraceManager |
12 | 13 |
|
13 | 14 | from uipath.runtime.errors import ( |
@@ -167,16 +168,21 @@ def __exit__(self, exc_type, exc_val, exc_tb): |
167 | 168 |
|
168 | 169 | if exc_type: |
169 | 170 | # Create error info from exception |
170 | | - if isinstance(exc_val, UiPathRuntimeError): |
171 | | - error_info = exc_val.error_info |
172 | | - else: |
173 | | - # Generic error |
174 | | - error_info = UiPathErrorContract( |
175 | | - code=f"ERROR_{exc_type.__name__}", |
176 | | - title=f"Runtime error: {exc_type.__name__}", |
177 | | - detail=str(exc_val), |
178 | | - category=UiPathErrorCategory.UNKNOWN, |
179 | | - ) |
| 171 | + match exc_type: |
| 172 | + case UiPathFaultedTriggerError(): |
| 173 | + error_info = UiPathRuntimeError.from_resume_trigger_error( |
| 174 | + exc_type |
| 175 | + ).error_info |
| 176 | + case UiPathRuntimeError(): |
| 177 | + error_info = exc_val.error_info |
| 178 | + case _: |
| 179 | + # Generic error |
| 180 | + error_info = UiPathErrorContract( |
| 181 | + code=f"ERROR_{exc_type.__name__}", |
| 182 | + title=f"Runtime error: {exc_type.__name__}", |
| 183 | + detail=str(exc_val), |
| 184 | + category=UiPathErrorCategory.UNKNOWN, |
| 185 | + ) |
180 | 186 |
|
181 | 187 | self.result.status = UiPathRuntimeStatus.FAULTED |
182 | 188 | self.result.error = error_info |
|
0 commit comments